Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Auto include in Rails Console

console

  • Please log in to reply
1 reply to this topic

#1 assafshomer

assafshomer

    Passenger

  • Members
  • 2 posts

Posted 16 July 2014 - 06:36 AM

Is there a way to configure the console to always include certain modules?



#2 Ohm

Ohm

    Driver

  • Moderators
  • 451 posts
  • LocationCopenhagen

Posted 16 July 2014 - 11:29 AM

You can create a .irbrc-file in your home directory. This will get run every time you launch a IRB or Rails console.

 

There's no local .irbrc-file, only the global (~/.irbrc) one, however, you can edit this to require the local one, if they exists.

def load_irbrc(path)
  irbrc = File.join(path, '.irbrc')
  load irbrc if File.exist?(irbrc)
end

load_irbrc Dir.pwd

Blog: http://ohm.sh | Twitter: @madsohm | Work: Lokalebasen.dk





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users