Reputation: 33
I would like to place the .irbrc file in my project folder to configure the irb console just for that specific project. I am aware that i can configure .irbrc placing it in the home folder but i would like to avoid that, i just want to require all the files of my project when i get into the console, but i am not looking for a permanent behaviour I am trying to place .irbrc file in the project root but it does not seem to be requiring anything if i place it there. Is it possible to do it??. Any suggestion would be much appreciated. Thank you so much
Upvotes: 3
Views: 843
Reputation: 52738
Just adding a note that helped me:
Is it possible to place the .irbrc file in the project folder?
Yes, you most certainly can, as explained by @Alex:
you should be able to add
.irbrc
file into your project directory, no extra steps required.
Just create a file called .irbrc in your app's root directory. Then you can add configs to it (in my case I added this solitary line IRB.conf[:USE_PAGER] = false
).
Note: I think when .irbrc is present, opening the rails console will create an .irb_history file, which you may wish to add to .gitignore
.
Upvotes: 0
Reputation: 1413
Does your project have a ./bin/console
file? Probably that's what you're looking for.
Here is some information about it: Your Ruby App Should Have a bin/console
.
However, you can pass another file to be loaded in irb
:
IRBRC="~/Documents/.irbrc" irb
You can look at how irb
loads it in init.rb, if you're interested.
Upvotes: 2