From 32eef69dc1abbf9b67de780a882754e1717c2a3b Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Sun, 20 Feb 2011 20:42:35 +0000 Subject: Delegate Association#options to the reflection, and replace 'reflection.options' with 'options'. Also add through_options and source_options methods for through associations. --- activerecord/lib/active_record/associations/association.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'activerecord/lib/active_record/associations/association.rb') diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index fa1200a949..df18afe57a 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -99,12 +99,12 @@ module ActiveRecord def association_scope scope = target_klass.unscoped scope = scope.create_with(creation_attributes) - scope = scope.apply_finder_options(reflection.options.slice(:readonly, :include)) - scope = scope.where(interpolate(reflection.options[:conditions])) + scope = scope.apply_finder_options(options.slice(:readonly, :include)) + scope = scope.where(interpolate(options[:conditions])) if select = select_value scope = scope.select(select) end - scope = scope.extending(*Array.wrap(reflection.options[:extend])) + scope = scope.extending(*Array.wrap(options[:extend])) scope.where(construct_owner_conditions) end @@ -175,7 +175,7 @@ module ActiveRecord end def select_value - reflection.options[:select] + options[:select] end # Implemented by (some) subclasses @@ -191,8 +191,8 @@ module ActiveRecord else attributes[reflection.foreign_key] = owner[reflection.active_record_primary_key] - if reflection.options[:as] - attributes["#{reflection.options[:as]}_type"] = owner.class.base_class.name + if options[:as] + attributes["#{options[:as]}_type"] = owner.class.base_class.name end end attributes -- cgit v1.2.3