Permalink
Browse files

Disable validations for associated belongs_to record by default

  • Loading branch information...
1 parent 7f140bb commit 71bf756ea21f338771b53d02951d6654bd295649 @lifo lifo committed Jun 11, 2008
Showing with 3 additions and 3 deletions.
  1. +1 −1 activerecord/lib/active_record/associations.rb
  2. +2 −2 activerecord/test/models/developer.rb
@@ -940,7 +940,7 @@ def belongs_to(association_id, options = {})
)
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
@@ -56,8 +56,8 @@ def log=(message)
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)

0 comments on commit 71bf756

Please sign in to comment.