diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-07-31 17:31:30 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-07-31 17:31:30 -0700 |
commit | bc06ee374b953a985e045370cbb260cda59b7130 (patch) | |
tree | cfecc1f24e45c5a7af858dccb271df4abc116b30 /activerecord | |
parent | a9087ab25a2886e724cd58448315aad3fa8005ae (diff) | |
download | rails-bc06ee374b953a985e045370cbb260cda59b7130.tar.gz rails-bc06ee374b953a985e045370cbb260cda59b7130.tar.bz2 rails-bc06ee374b953a985e045370cbb260cda59b7130.zip |
we should not allow invalid objects to be constructed
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/builder/association.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb index a4faeeedec..5fa225f47a 100644 --- a/activerecord/lib/active_record/associations/builder/association.rb +++ b/activerecord/lib/active_record/associations/builder/association.rb @@ -41,6 +41,8 @@ module ActiveRecord::Associations::Builder @options = options end + validate_options + if @scope && @scope.arity == 0 prev_scope = @scope @scope = proc { instance_exec(&prev_scope) } @@ -52,7 +54,6 @@ module ActiveRecord::Associations::Builder end def build - validate_options define_accessors configure_dependency if options[:dependent] reflection = ActiveRecord::Reflection.create(macro, name, scope, options, model) |