user14412
user14412

Reputation: 1017

Rails Console Doesn't Load .irbrc While Irb Does On Windows

I installed Rails 3.2.8 using RailsInstaller on Windows 7 64bit (Ruby 1.9.3). I then created a .irbrc file in my %HOME% directory - C:\Users\Username with the following content:

def h obj
    puts "This object is #{obj}"
end

If I use irb in the command line, I can access that method in .irbrc. However, when I fire up rails c, the method is not accessible, which means the .irbrc file is not loaded by rails c.

Could anyone please help me figure out why is irb able to load the .irbrc file, but rails console is not loading it at all?

Thank you

Upvotes: 0

Views: 1228

Answers (1)

Prakash Murthy
Prakash Murthy

Reputation: 13077

I tried your example on a Rails 3.2.1 application on Windows 7, and .irbrc file was loaded in the rails console.

Nothing unusual with the PATH variable; it just points to C:\RailsInstaller\Git\cmd;C:\Program Files\RailsInstaller\Ruby1.9.3\bin

Try setting the IRBRC variable as Dr. Nic suggests at the bottom of this blogpost: http://drnicwilliams.com/2006/10/12/my-irbrc-for-consoleirb/

An old Stack Overflow question How do I get IRBRC running on Win32 for Ruby console? could give some clues as well.

Upvotes: 0

Related Questions