diff options
author | Joshua Nichols <josh@technicalpickles.com> | 2009-08-09 13:13:34 -0400 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-08-09 21:46:52 +0100 |
commit | 0ec64bea9293dd21588359da80bb43b82886cf2c (patch) | |
tree | ad3516dfe71d6dda6beb438b0428ea862e0beb11 /activerecord/lib/active_record | |
parent | ae47f7575da3dc3c74fa63136d00492ba4beb278 (diff) | |
download | rails-0ec64bea9293dd21588359da80bb43b82886cf2c.tar.gz rails-0ec64bea9293dd21588359da80bb43b82886cf2c.tar.bz2 rails-0ec64bea9293dd21588359da80bb43b82886cf2c.zip |
Added back support for destroying an association's object by id. [#2306 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/association_collection.rb | 1 |
1 files changed, 1 insertions, 0 deletions
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 |