質問

I'm getting the error uninitialized constant SessionsController I've searched, and can only find explanations of this error in reference to a NameError Does anyone know what the error means?

役に立ちましたか?

解決

That is one of two "subtypes of" Name Error dealing with uninitialized variables. The language of "uninitialized constant" is due to the fact that SessionsController is capitalized. Both types are illustrated below:

new-host-3:bot palfvin$ irb
2.0.0p247 :001 > foobar
NameError: undefined local variable or method `foobar' for main:Object
    from (irb):1
    from /Users/palfvin/.rvm/rubies/ruby-2.0.0-p247/bin/irb:16:in `<main>'
2.0.0p247 :002 > Foobar
NameError: uninitialized constant Foobar
    from (irb):2
    from /Users/palfvin/.rvm/rubies/ruby-2.0.0-p247/bin/irb:16:in `<main>'
2.0.0p247 :003 > 

他のヒント

It means that you're trying to use a Class or a Module that wasn't defined yet. Probably because you forgot to require them.

Make sure that this class SessionsController has been declared in your sessions_controller.rb.

Read more: http://ruby.about.com/od/faqs/qt/Nameerror-Uninitialized-Constant-Object-Something.htm

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top