Sha256: b6b4b3156152fa83a32ae3fe39670ad0b4054d266e69d9b92eab6f525da0e311
Contents?: true
Size: 695 Bytes
Versions: 4
Compression:
Stored size: 695 Bytes
Contents
module FinePrint class Signature < ActiveRecord::Base belongs_to :contract, :inverse_of => :signatures belongs_to :user, :polymorphic => true validate :contract_published, :on => :create validates :contract, :presence => true, :uniqueness => {:scope => [:user_type, :user_id]} validates :user, :presence => true default_scope { order(:contract_id, :user_type, :user_id) } protected ############## # Validation # ############## def contract_published return if contract.is_published? errors.add(:contract, I18n.t( 'fine_print.signature.errors.contract.not_published')) false end end end
Version data entries
4 entries across 4 versions & 1 rubygems