I have a script called query.rb in my lib directory. I want to require it so I can run it from the Rails console. I wonder if this is possible. The script work fine from within the application, so I know it's well formed and functional.
For Rails 3+, use load "#{Rails.root}/lib/your_lib_file.rb"
load works like require, but allows you to re-load files as you edit them (unlike require, which you cant run again). See https://stackoverflow.com/a/6361502/513739
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With