-
-
Save MyArtChannel/941174 to your computer and use it in GitHub Desktop.
# Add this to the end of your development.rb and add | |
# | |
# gem 'pry' | |
# | |
# to your Gemfile and run bundle to install. | |
silence_warnings do | |
begin | |
require 'pry' | |
IRB = Pry | |
rescue LoadError | |
end | |
end |
Has anyone noticed whether this prevents reload!
from working in the rails console?
reload! definitely works for me, yes
Hmmm, for some reason my models don't get reloaded... then there must be something weird in my app environment. Thanks @robbevan
alias pryr="pry -r ./config/environment -r rails/console/app -r rails/console/helpers"
@grosser FTW!
much obliged grosser, that worked great for me. No messing with the actual project source
I use following one-liner because it leaves irb command unchanged and bundle console
runs whatever you have in Gemfile (eg. bundle console development
). And use pry
if you want repl without Gemfile.
echo "Pry.start || exit rescue LoadError" > ~/.irbrc
I use this in my zshrc:
pry () {
if [ -e Gemfile.lock ] && [ -e ./config/environment.rb ] && grep -q pry Gemfile.lock
then
bundle exec pry -r ./config/environment "$@"
else
/usr/bin/pry "$@"
fi
}
@grosser reload!
doesn't work here using the alias. Any ideas?
@l0b0 see where reload! is defined and include this too or see what else gets included to irb
@13k thanks works great
My project based on another core project. when I use this. the "title" of shell become very long. e.g original is "ree-1.8.7-2011.03 :001 >"
after I use pry its become to "<@resource = "example"> *****" a giant title..