Permalink
Browse files

Replaced the deprecated _delete attribute with _destroy

Support for _delete was removed between rails 2.3.5 and 2.3.14.
  • Loading branch information...
nilbus committed Sep 12, 2011
1 parent ce05f5d commit 190ee5a40bb0156164d90eceed6be6ef6be0a1e0
Showing with 3 additions and 3 deletions.
  1. +1 −1 README.mdown
  2. +2 −2 lib/mass_assignment_fu.rb
View
@@ -92,7 +92,7 @@ attr_accessible_for(*fieldset_name*, *field_list*)
* :foo - Delegate which fields can be updated on the foo association to the associated Foo model.
Everything is restricted that is not explicitly allowed with attr_accessible or attr_accessible_for.
In the case of attr_accessible_for, it checks for a fieldset with the same name.
* {:foo => :all} - Make all attributes on Foo updatable, include "_delete".
* {:foo => :all} - Make all attributes on Foo updatable, include "_destroy".
* {:foo => [:attr1, :attr2]} - Make the given list of attributes on Foo updatable.
* {:foo => [:attr1, :attr2, {:bar => :all}]} - Foo's associations can also be updated.
@@ -115,8 +115,8 @@ def attributes_that_can_be_updated(assigned_attributes, safe_attributes, explici
if value.is_a?(Hash)
if safe_attributes[key] == "all" and associated_class
# {:association => 'all'} includes all of association's properties but not its associations. It translates to
# {:association => ['attr1', 'attr2', 'attrN', '_delete']}
kept_attributes.store(key, associated_class.new.remove_disallowed_attributes_from_mass_assignment(value, associated_class.new.attributes.keys << '_delete', nest_level+1))
# {:association => ['attr1', 'attr2', 'attrN', '_destroy']}
kept_attributes.store(key, associated_class.new.remove_disallowed_attributes_from_mass_assignment(value, associated_class.new.attributes.keys << '_destroy', nest_level+1))
elsif safe_attributes[key] == "true" and associated_class
# When one of the allowed_attributes was an associated_class but no fields are specified,
# check the associated_class model's attr_accessible_for, attr_accessible, and attr_protected.

0 comments on commit 190ee5a

Please sign in to comment.