This project is archived and is in readonly mode.

#4245 ✓invalid
millr

rails runner doesn't set-up rails environment

Reported by millr | March 21st, 2010 @ 12:33 AM

When running a script via rails runner the script is not placed in the rails environment.

Running the following from within a rails 3 app directory:

rails runner 'Rails.root'

Produces the following error:

/usr/local/lib/ruby19/gems/1.9.1/gems/railties-3.0.0.beta/lib/rails/commands/runner.rb:45:in `eval': uninitialized constant Rails (NameError)
    from /usr/local/lib/ruby19/gems/1.9.1/gems/railties-3.0.0.beta/lib/rails/commands/runner.rb:45:in `eval'
    from /usr/local/lib/ruby19/gems/1.9.1/gems/railties-3.0.0.beta/lib/rails/commands/runner.rb:45:in `<top (required)>'
    from /usr/local/lib/ruby19/gems/1.9.1/gems/railties-3.0.0.beta/lib/rails/commands.rb:60:in `require'
    from /usr/local/lib/ruby19/gems/1.9.1/gems/railties-3.0.0.beta/lib/rails/commands.rb:60:in `<top (required)>'
    from /private/var/www/appdir/script/rails:10:in `require'
    from /private/var/www/appdir/script/rails:10:in `<main>'

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Tags

Pages