Run ruby file in rails console

ruby, ruby-on-rails, ruby-on-rails-3

Solution

You can run the code in the file in the context of your rails app with

rails runner

http://guides.rubyonrails.org/command_line.html#rails-runner

Problem

I've created a file `ebm.rb` script to add new entries to a database in rails. The file is very long, and uses some rails models. Can I easily execute `ebm.rb` in the `rails console`? I tried something with `load` and `require`, but that didn't work. My `ebm.rb` file is located in `C:\Sites\ebm` and my rails project in `C:\Sites\rublesql`.

Original source