Skip to content

Instantly share code, notes, and snippets.

@rondale-sc
Created October 18, 2011 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rondale-sc/1296956 to your computer and use it in GitHub Desktop.
Save rondale-sc/1296956 to your computer and use it in GitHub Desktop.
pconsole bash/zsh alias
pconsole () {
if [[ -n $1 ]];
then RAILS_ENV=$1 pry -r ./config/environment.rb -r rails/console/app -r rails/console/helpers;
elif [[ -r ./config/environment.rb ]];
then RAILS_ENV=development pry -r ./config/environment.rb -r rails/console/app -r rails/console/helpers;
elif [[ -z $1 ]];
then pry;
fi }
# Place in ~/.zshrc || ~/.bashrc to open pry with rails environment like this:
# $-> pconsole
# [1] pry(main)> Rails.env
# => "development"
# $-> pconsole production
# [1] pry(main)> Rails.env
# => "production"
# in non rails env
# $-> pconsole
# [1] pry(main)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment