Db:backup and db:restore tasks

I’ve created 2 tasks, backup and restore. They seem to be perfectly working fine running from the command line.
The issue is, they want buttons on a form that run these tasks, (which I did). But, when the rake restore task is run from within the application the database doesn’t get dropped (because it’s active) and it doesn’t fully restore the data that was missing. I don’t know how to proceed.

nevermind, db:reset instead of db:drop worked!