Ruby on Rails Developer Question:

Tell me what’s the difference between destroy and delete?

Tweet Share WhatsApp

Answer:

Both of these methods delete the record in the database. The different between them is that:

☛ destroy – checks and deletes connected records if necessary and calls callbacks i.e. before_destroy, after_destroy etc.
☛ delete – doesn’t call callbacks and removes an object directly from the database.

Download Ruby on Rails Developer PDF Read All 30 Ruby on Rails Developer Questions
Previous QuestionNext Question
Do you know who developed Rails?Tell us what is the purpose of the resources method in the code snippet below?