Is there a way to execute some code that runs only when the console starts? A kind of rc file ( .bashrc , .zshrc , etc.)? I find that I always do certain things a lot.
For example, where would I place this
u = User.find_by_username('my_console_user')
so is u available in rails console ?
I resorted to this, using $ as a global variable declaration and using the obscure console do . I guess there is something more elegant somehow ...
class Application < Rails::Application
pixelearth
source share