Possible to configure rails to load per project .irbrc file?

419 Views Asked by At

Can rails load .irbrc from the rails project root such as ~/rails-projct/.irbrc. Rather then ~/.irbrc. Since it would be nice to add configuration that's specific to a project.

1

There are 1 best solutions below

0
billkw On

Per the docs:

IRB reads from ~/.irbrc when it's invoked. If ~/.irbrc doesn't exist, irb will try to read in the following order:

  • .irbrc
  • irb.rc
  • _irbrc
  • $irbrc

Meaning that this is possible, but only if you don't have a .irbrc file in your home directory. Tested and confirmed in Ruby 2.7.

If that's not possible, you'll have to rely on command line options and/or environment variables.