app/models/fine_print/signature.rb in fine_print-1.4.1 vs app/models/fine_print/signature.rb in fine_print-2.0.0
- old
+ new
@@ -1,13 +1,14 @@
module FinePrint
class Signature < ActiveRecord::Base
belongs_to :contract, :inverse_of => :signatures
belongs_to :user, :polymorphic => true
- before_create :contract_published
+ validate :contract_published, :on => :create
- validates_presence_of :contract, :user_type, :user_id
- validates_uniqueness_of :contract_id, :scope => [:user_type, :user_id]
+ validates :contract, :presence => true,
+ :uniqueness => {:scope => [:user_type, :user_id]}
+ validates :user, :presence => true
default_scope { order(:contract_id, :user_type, :user_id) }
protected