From 800b899f9685a12e0e255e29369eac36e2985d28 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 11 Jun 2007 07:15:59 +0000 Subject: Remove deprecated push_with_attributes. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6997 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../has_and_belongs_to_many_association.rb | 27 ++++------------------ 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'activerecord/lib') 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 c8e216f072..2155ce8e30 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 @@ -5,7 +5,7 @@ module ActiveRecord super construct_sql end - + def build(attributes = {}) load_target record = @reflection.klass.new(attributes) @@ -27,7 +27,7 @@ module ActiveRecord def find_first load_target.first end - + def find(*args) options = Base.send(:extract_options_from_args!, args) @@ -66,24 +66,7 @@ module ActiveRecord args << options @reflection.klass.find(*args) end - end - - # Deprecated as of Rails 1.2. If your associations require attributes - # you should be using has_many :through - def push_with_attributes(record, join_attributes = {}) - raise_on_type_mismatch(record) - join_attributes.each { |key, value| record[key.to_s] = value } - - callback(:before_add, record) - insert_record(record) unless @owner.new_record? - @target << record - callback(:after_add, record) - - self end - deprecate :push_with_attributes => "consider using has_many :through instead" - - alias :concat_with_attributes :push_with_attributes protected def count_records @@ -121,10 +104,10 @@ module ActiveRecord @owner.connection.execute(sql) end - + return true end - + def delete_records(records) if sql = @reflection.options[:delete_sql] records.each { |record| @owner.connection.execute(interpolate_sql(sql, record)) } @@ -134,7 +117,7 @@ module ActiveRecord @owner.connection.execute(sql) end end - + def construct_sql interpolate_sql_options!(@reflection.options, :finder_sql) -- cgit v1.2.3