Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

rails runner doesn't set-up rails environment

#4245

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>'

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

State: invalid
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. millr
    millr

    Sorry, this was fixed here: http://github.com/rails/rails/commit/39ebd6eb2b6c90756514798450eb15...

    I should have looked a little deeper...

    March 21st, 2010 @ 06:25 PM

  2. José Valim
    José Valim
    • State changed from new to invalid

    March 21st, 2010 @ 06:27 PM