Do more with rails console by configuring ~/.irbrc 🎉

Rishi Pithadiya
Simply Dev
Published in
2 min readJun 21, 2020

It´s better to wait for a productive programmer to become available than it is to wait for the first available programmer to become productive. — Steve McConnell

What is ~/.irbrc file? đź”–

  • After work with multiple Rails apps, you might have some methods and preferred ways of working with them.
  • i.e. you're using few generalized methods or configuration your IRB session(rails console) in a single project and want to have the same methods & configuration on other projects you’re working on, you can add those methods & configuration in your ~/.irbrc file.
  • You can create ~/.irbrc file in your root directory if it’s not present.

Things you can include in your ~/.irbrc file đź—„

  • Configurations which need to be used in all Rails Apps
  • Methods which need to be used in all Rails Apps
  • Require/load specific file(s) or Gem(s)
  • Hacky convenience methods that help you play with your objects

My .irbrc file 🧮

My current ~/.irbrc file which contains lots of helpful things.

How to search awesome .irbrc file created by other devs đź“­

Just click on the following URL and it’ll list all ~/.irbrc files created by other GitHub developers, you can create your file and add everything you need if you find anything useful -

References đź“Ś

Found this post useful? please click the đź‘Ź button and share it to help others find it! Feel free to leave a comment below.

--

--

Rishi Pithadiya
Simply Dev
Writer for

Finding happiness in words, food, places & untold stories ✌🏼 rishi.tips