diff options
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index b04cb81a5c..9ee06ffbcb 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -89,11 +89,16 @@ module ActiveRecord if @target.respond_to?(method) || (!@association_class.respond_to?(method) && Class.respond_to?(method)) super else - @association_class.constrain( + @association_class.with_scope( + :find => { :conditions => @finder_sql, :joins => @join_sql, - :readonly => false, - :creation => { @association_class_primary_key_name => @owner.id }) do + :readonly => false + }, + :create => { + @association_class_primary_key_name => @owner.id + } + ) do @association_class.send(method, *args, &block) end end |