Depending on what I'm working on, I routinely define variables (e.g., f = Foo.last) when I open rails console.
Is there any way to do this automatically in my development environment?
For what it's worth, I'm using pry.
I can do this, but the session will exit:
$ rails c <<EOF
heredoc> f = Foo.last
heredoc> EOF
If you're fine with instance variables, you can add those to
~/.pryrcWith local variables this won't work, because they're local to their scope (hence the name).
What I do myself, is have all of the "setup" commands in a separate text file. Then in the new rails console, I just paste it.
@)