From 0ec64bea9293dd21588359da80bb43b82886cf2c Mon Sep 17 00:00:00 2001 From: Joshua Nichols Date: Sun, 9 Aug 2009 13:13:34 -0400 Subject: Added back support for destroying an association's object by id. [#2306 status:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activerecord/lib/active_record/associations/association_collection.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/lib/active_record/associations') diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index e67ccfb228..1b7bf42b91 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -208,6 +208,7 @@ module ActiveRecord # Note that this method will _always_ remove records from the database # ignoring the +:dependent+ option. def destroy(*records) + records = find(records) if records.any? {|record| record.kind_of?(Fixnum) || record.kind_of?(String)} remove_records(records) do |records, old_records| old_records.each { |record| record.destroy } end -- cgit v1.2.3