am trying to load a file where i have all my setting into rails console. i want to do it because when i use the console there is too much repetition . thank you
Asked
Active
Viewed 1.4k times
10
-
Please expand your answer to include an example of what you're currently doing in order to load the console. – Ryan Bigg Apr 05 '10 at 09:40
3 Answers
6
From within Rails console or IRB you can load a file with the require method. For example require foo.rb
will execute all the statements in foo.rb
. You can use relative or absolute paths.

Gordon Wilson
- 26,244
- 11
- 57
- 60
-
I had to put quotes around the filename, to avoid a `NameError: undefined local variable or method 'foo' ` – Tom Hundt Nov 21 '16 at 19:07
0
As stated before you can use .irbrc file, take a look here http://github.com/ryanb/dotfiles to see how to separate your rails specific code into a railsrc file.

Fran
- 1,073
- 10
- 19