Skip to content

Instantly share code, notes, and snippets.

@michaeldever
Last active December 5, 2017 16:59
Show Gist options
  • Save michaeldever/24e5aaed918e5be7a89348ccb660a4d0 to your computer and use it in GitHub Desktop.
Save michaeldever/24e5aaed918e5be7a89348ccb660a4d0 to your computer and use it in GitHub Desktop.
ActiveRecord Connection
def establish_active_record_connection
defined?(ActiveRecord::Base) && ActiveRecord::Base.establish_connection
end
Daemons.run_proc('rabbit_mq', multiple: false, backtrace: true, log_output: true) do
begin
establish_active_record_connection
rescue StandardError => e
puts e.message
puts e.backtrace
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment