Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Capistrano task to remotely connect to rails console
# Based off of
desc "Remote console on the production appserver"
task :console, :roles => ENV['ROLE'] || :web do
hostname = find_servers_for_task(current_task).first
puts "Connecting to #{hostname}"
exec "ssh -l #{user} #{hostname} -t 'source ~/.profile && cd #{current_path} && bundle exec rails c #{rails_env}'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment