This project is archived and is in readonly mode.
rails runner uninitialized constant Object
Reported by trevor | March 23rd, 2010 @ 12:33 AM | in 3.0.2
rails runner doesn't seem to be aware of objects in the rails environment anymore
% rails myapp
% cd myapp
% rails g scaffold post title:string body:text published:boolean
# edit a.rb
% cat a.rb
puts Rails.root
puts Post.count
% rails runner a.rb
a.rb:1:in `': uninitialized constant Object::Rails (NameError)
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta/lib/rails/commands/runner.rb:43:in `eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta/lib/rails/commands/runner.rb:43:in `'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta/lib/rails/commands.rb:60:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta/lib/rails/commands.rb:60:in `'
from /private/tmp/myapp/script/rails:10:in `require'
from /private/tmp/myapp/script/rails:10:in `'
Comments and changes to this ticket
-

-

trevor March 23rd, 2010 @ 12:34 AM
- Tag set to rails3 runner
-

moresheth March 25th, 2010 @ 09:32 AM
It looks like someone has a fix for this:
http://github.com/rails/rails/commit/39ebd6eb2b6c90756514798450eb15...Since trying to re-install the Rails 3 beta didn't work, and I'm not sure if there's an easy way to patch it from that commit, I just made the changes myself. The location of the files depends on where your ruby is installed, so on one machine, these were the files that I changed:
/var/lib/gems/1.8/gems/railties-3.0.0.beta/lib/rails/commands.rb /var/lib/gems/1.8/gems/railties-3.0.0.beta/lib/rails/commands/runner.rbOn another, it was these:
/usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/commands.rb /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/commands/runner.rbYou're just moving the "require ENV_PATH" line.
-

José Valim March 26th, 2010 @ 12:06 AM
- Milestone cleared.
- State changed from new to resolved
-

Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
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>