I have a Rails 4 application that I use in conjunction with sidekiq to run asynchronous jobs. One of the jobs I normally run outside of my Rails application is
sidekiq
If you want to execute raw SQL through active record you can use this API: ActiveRecord::Base.connection.execute("SELECT COUNT(*) FROM users")
ActiveRecord::Base.connection.execute("SELECT COUNT(*) FROM users")