Skip to content

Commit

Permalink
Remove deprecated '_delete' option from NestedAttributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy committed Jan 7, 2010
1 parent 3d17d79 commit b3bd101
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
15 changes: 2 additions & 13 deletions activerecord/lib/active_record/nested_attributes.rb
Expand Up @@ -260,21 +260,11 @@ def _destroy
marked_for_destruction?
end

# Deal with deprecated _delete.
#
def _delete #:nodoc:
ActiveSupport::Deprecation.warn "_delete is deprecated in nested attributes. Use _destroy instead."
_destroy
end

private

# Attribute hash keys that should not be assigned as normal attributes.
# These hash keys are nested attributes implementation details.
#
# TODO Remove _delete from UNASSIGNABLE_KEYS when deprecation warning are
# removed.
UNASSIGNABLE_KEYS = %w( id _destroy _delete )
UNASSIGNABLE_KEYS = %w( id _destroy )

# Assigns the given attributes to the association.
#
Expand Down Expand Up @@ -371,8 +361,7 @@ def assign_to_or_mark_for_destruction(record, attributes, allow_destroy)

# Determines if a hash contains a truthy _destroy key.
def has_destroy_flag?(hash)
ConnectionAdapters::Column.value_to_boolean(hash['_destroy']) ||
ConnectionAdapters::Column.value_to_boolean(hash['_delete']) # TODO Remove after deprecation.
ConnectionAdapters::Column.value_to_boolean(hash['_destroy'])
end

# Determines if a new record should be build by checking for
Expand Down
6 changes: 0 additions & 6 deletions activerecord/test/cases/nested_attributes_test.rb
Expand Up @@ -81,12 +81,6 @@ def test_a_model_should_respond_to_underscore_destroy_and_return_if_it_is_marked
assert ship._destroy
end

def test_underscore_delete_is_deprecated
ActiveSupport::Deprecation.expects(:warn)
ship = Ship.create!(:name => 'Nights Dirty Lightning')
ship._delete
end

def test_reject_if_method_without_arguments
Pirate.accepts_nested_attributes_for :ship, :reject_if => :new_record?

Expand Down

0 comments on commit b3bd101

Please sign in to comment.