Disable validations for associated belongs_to record by default

This commit is contained in:
Pratik Naik 2008-06-11 12:39:56 +01:00
parent 7f140bbdda
commit 71bf756ea2
2 changed files with 3 additions and 3 deletions

View File

@ -940,7 +940,7 @@ module ActiveRecord
)
end
add_single_associated_save_callbacks(reflection.name) unless options[:validate] == false
add_single_associated_save_callbacks(reflection.name) if options[:validate] == true
configure_dependency_for_belongs_to(reflection)
end

View File

@ -56,8 +56,8 @@ class Developer < ActiveRecord::Base
end
class AuditLog < ActiveRecord::Base
belongs_to :developer
belongs_to :unvalidated_developer, :class_name => 'Developer', :validate => false
belongs_to :developer, :validate => true
belongs_to :unvalidated_developer, :class_name => 'Developer'
end
DeveloperSalary = Struct.new(:amount)