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?
In one of my programs I use a model called User and then use
Share
It hasn’t been deprecated, it’s just been moved. The
destroymethod is now a member ofActiveRecord::Persistenceinstead ofActiveRecord::Base. However, you still call it the exact same way: