Skip to content

Instantly share code, notes, and snippets.

@phil-monroe
Created June 16, 2012 00:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phil-monroe/2939400 to your computer and use it in GitHub Desktop.
Save phil-monroe/2939400 to your computer and use it in GitHub Desktop.
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