Is there a way to execute some code that is run only when the console starts? Kind of like an rc file (.bashrc, .zshrc, etc.)? I find myself always
.bashrc
.zshrc
If you use irb, just add a method in ~/.irbrc (create one if does not exist):
irb
~/.irbrc
def find_by_username(username) User.find_by_username('my_console_user') end
Or add to ~/.pryrc if you use pry-rails.
~/.pryrc
pry-rails
Hope this helps!