Expected foo.rb to define Foo - in my case
Fellas! I've run into the
Expected foo.rb to define Foo
problem. I can't figure out what the hell is the solution. I have run the rails console and asked for that model to have a more detailed errore code. I got this:
irb(main):002:0> c = Card_开发者_运维技巧positions.find(1)
NameError: uninitialized constant Card_positions
from (irb):2
from C:/Programozas/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/
rails/commands/console.rb:44:in `start'
from C:/Programozas/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/
rails/commands/console.rb:8:in `start'
from C:/Programozas/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/
rails/commands.rb:23:in `<top (required)>'
from C:/Programozas/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_req
uire.rb:59:in `require'
from C:/Programozas/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_req
uire.rb:59:in `rescue in require'
from C:/Programozas/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_req
uire.rb:35:in `require'
from script/rails:6:in `<main>'
Solution ideas?
For a table named card_positions
, you should be doing CardPosition.find(1)
.
精彩评论