Pass ruby script file to rails console

ruby, ruby-on-rails-3

Solution

In the meantime, this solution has been supported.

rails r PATH_TO_RUBY_FILE

Much simpler now.

Problem

Is there a way to pass ruby file, foo.rb to rails console. Expected results would be after console starts rails environment to run file. Or any other way which would allow me to execute file in rails environment, triggered from command prompt.

Original source

Related problems