Reputation: 8434
In one of my programs I use a model called User and then use user = User.create(attr)
where attr are the necessary attributes for this action. Then to destroy this I use user.destroy
. However, I see that in the API Doc the destroy instance method for ActiveRecord::Base is deprecated -- is there a new/better way to go about destroying a model object?
Upvotes: 0
Views: 365
Reputation: 124439
It hasn't been deprecated, it's just been moved. The destroy
method is now a member of ActiveRecord::Persistence
instead of ActiveRecord::Base
. However, you still call it the exact same way:
user.destroy
Upvotes: 1