1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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 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) configure_dependency_for_belongs_to(reflection)
end end

View file

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