diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-02-20 20:42:35 +0000 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-21 10:16:14 -0800 |
commit | 32eef69dc1abbf9b67de780a882754e1717c2a3b (patch) | |
tree | ec88ff3d6a212e900ff63dbcf49172d501782ea8 /activerecord/lib/active_record/associations/association.rb | |
parent | 73ff0076b37316af685bc411bd11a7908d7794f6 (diff) | |
download | rails-32eef69dc1abbf9b67de780a882754e1717c2a3b.tar.gz rails-32eef69dc1abbf9b67de780a882754e1717c2a3b.tar.bz2 rails-32eef69dc1abbf9b67de780a882754e1717c2a3b.zip |
Delegate Association#options to the reflection, and replace 'reflection.options' with 'options'. Also add through_options and source_options methods for through associations.
Diffstat (limited to 'activerecord/lib/active_record/associations/association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/association.rb | 12 |
1 files changed, 6 insertions, 6 deletions
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 |