Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Capistrano task to remotely connect to rails console
# Based off of https://gist.github.com/1115513
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}'"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment