diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-13 10:44:34 -0800 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-11-13 10:53:19 -0800 |
commit | bd51790895fc75a3b4e19e8dd7aa6dc389d77068 (patch) | |
tree | ef3ccd2dcfd84f618116b99bc2ede21b69b2ccf5 /activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb | |
parent | 0da71980cd61aa6297749d0ea8520785c9a5280f (diff) | |
download | rails-bd51790895fc75a3b4e19e8dd7aa6dc389d77068.tar.gz rails-bd51790895fc75a3b4e19e8dd7aa6dc389d77068.tar.bz2 rails-bd51790895fc75a3b4e19e8dd7aa6dc389d77068.zip |
Split arel_table into method to get a relation and another to memoize the default relation.
Diffstat (limited to 'activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index c646fe488b..ce4e96637b 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -56,7 +56,7 @@ module ActiveRecord if @reflection.options[:insert_sql] @owner.connection.insert(interpolate_sql(@reflection.options[:insert_sql], record)) else - relation = arel_table(@reflection.options[:join_table]) + relation = arel_table_for(@reflection.options[:join_table]) attributes = columns.inject({}) do |attrs, column| case column.name.to_s when @reflection.primary_key_name.to_s @@ -82,7 +82,7 @@ module ActiveRecord if sql = @reflection.options[:delete_sql] records.each { |record| @owner.connection.delete(interpolate_sql(sql, record)) } else - relation = arel_table(@reflection.options[:join_table]) + relation = arel_table_for(@reflection.options[:join_table]) relation.conditions(relation[@reflection.primary_key_name].eq(@owner.id). and(Arel::Predicates::In.new(relation[@reflection.association_foreign_key], records.map(&:id))) ).delete |