diff options
author | Jan De Poorter <jan@defv.be> | 2008-06-11 13:08:35 +0200 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-06-11 12:21:57 +0100 |
commit | 7f140bbddaf70abc61570f6cfdcbfba5771ffc78 (patch) | |
tree | 6c3622bd7951295b58ec5c5bbfceeb7ffb6def21 /activerecord/test/models | |
parent | f728e57d2204a429f5282856ec89d4e047e72957 (diff) | |
download | rails-7f140bbddaf70abc61570f6cfdcbfba5771ffc78.tar.gz rails-7f140bbddaf70abc61570f6cfdcbfba5771ffc78.tar.bz2 rails-7f140bbddaf70abc61570f6cfdcbfba5771ffc78.zip |
Add :validate option to associations. [#301 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/test/models')
-rwxr-xr-x | activerecord/test/models/company.rb | 4 | ||||
-rw-r--r-- | activerecord/test/models/developer.rb | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index 70f83fa8e6..9fa810ac68 100755 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -26,6 +26,7 @@ class Firm < Company "AND (#{QUOTED_TYPE} = 'Client' OR #{QUOTED_TYPE} = 'SpecialClient' OR #{QUOTED_TYPE} = 'VerySpecialClient' )" has_many :clients_sorted_desc, :class_name => "Client", :order => "id DESC" has_many :clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id" + has_many :unvalidated_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :validate => false has_many :dependent_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :destroy has_many :exclusively_dependent_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all has_many :limited_clients, :class_name => "Client", :order => "id", :limit => 1 @@ -46,7 +47,8 @@ class Firm < Company has_many :plain_clients, :class_name => 'Client' has_many :readonly_clients, :class_name => 'Client', :readonly => true - has_one :account, :foreign_key => "firm_id", :dependent => :destroy + has_one :account, :foreign_key => "firm_id", :dependent => :destroy, :validate => true + has_one :unvalidated_account, :foreign_key => "firm_id", :class_name => 'Account', :validate => false has_one :account_with_select, :foreign_key => "firm_id", :select => "id, firm_id", :class_name=>'Account' has_one :readonly_account, :foreign_key => "firm_id", :class_name => "Account", :readonly => true end diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb index f77fd0e96d..7a64bed5ff 100644 --- a/activerecord/test/models/developer.rb +++ b/activerecord/test/models/developer.rb @@ -57,6 +57,7 @@ end class AuditLog < ActiveRecord::Base belongs_to :developer + belongs_to :unvalidated_developer, :class_name => 'Developer', :validate => false end DeveloperSalary = Struct.new(:amount) |