1

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?

4

2 回答 2

3

这意味着您正在尝试使用尚未定义的类或模块。可能是因为你忘了要求他们。

确保此类SessionsController已在您的sessions_controller.rb.

阅读更多:http ://ruby.about.com/od/faqs/qt/Nameerror-Uninitialized-Constant-Object-Something.htm

于 2013-09-27T19:08:08.167 回答
3

Name Error这是处理未初始化变量的两种“子类型”之一。SessionsController“未初始化的常量”的语言是由于大写的事实。两种类型如下图所示:

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 > 
于 2013-09-27T19:09:29.060 回答