I am working on creating a rake task to delete multiple tables and triggers.
My rake task:
task :remove_rubyrep do sql = <<-SQL DROP TABLE rr_logged_events, rr_running_flags, rr_pending_changes; SQL ActiveRecord::Base.establish_connection ActiveRecord::Base.connection.execute(sql) end
I tried running it like this:
rake remove_rubyrep RAILS_ENV=development rake remove_rubyrep
The problem is rake error errors:
rake aborted! ActiveRecord::ConnectionNotEstablished
Any suggestions on how to allow the rake task to connect to the database to execute raw sql? Thanks
Anapprentice
source share