6

I am new to rails and am trying to follow along with this prelaunch signup tutorial - http://railsapps.github.com/tutorial-rails-prelaunch-signup.html

When initializing the rails server using $ rails s, I get the following error message:

Users/pv/.rvm/gems/ruby-1.9.3-p194@rails326/gems/devise-2.1.2/lib/devise/models.rb:97:in `const_get': uninitialized constant Devise::Models::Invitable (NameError)

followed by a bunch of file paths, such as:

from /Users/patrickvihtelic/.rvm/gems/ruby-1.9.3-p194@rails326/gems/devise-2.1.2/lib/devise/models.rb:97:in `block (2 levels) in devise'
from /Users/patrickvihtelic/.rvm/gems/ruby-1.9.3-p194@rails326/gems/devise-2.1.2/lib/devise/models.rb:92:in `each'
from /Users/patrickvihtelic/.rvm/gems/ruby-1.9.3-p194@rails326/gems/devise-2.1.2/lib/devise/models.rb:92:in `block in devise'
from /Users/patrickvihtelic/.rvm/gems/ruby-1.9.3-p194@rails326/gems/devise-2.1.2/lib/devise/models.rb:123:in `devise_modules_hook!'
from /Users/patrickvihtelic/.rvm/gems/ruby-1.9.3-p194@rails326/gems/devise-2.1.2/lib/devise/models.rb:90:in `devise'
from /Users/patrickvihtelic/code/rails-prelaunch-signup/app/models/user.rb:5:in `<class:User>'
from /Users/patrickvihtelic/code/rails-prelaunch-signup/app/models/user.rb:1:in `<top (required)>'
from /Users/patrickvihtelic/.rvm/gems/ruby-1.9.3-p194@rails326/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:230:in `block in constantize'
from /Users/patrickvihtelic/.rvm/gems/ruby-1.9.3-p194@rails326/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `each'
from /Users/patrickvihtelic/.rvm/gems/ruby-1.9.3-p194@rails326/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `constantize'
from /Users/patrickvihtelic/.rvm/gems/ruby-1.9.3-p194@rails326/gems/devise-2.1.2/lib/devise.rb:256:in `get'

Can anyone please give me a hint or point me in the right direction?

Thanks!

Pat

4

2 回答 2

8

您需要添加:

require 'devise_invitable'

到 config/initializers/devise.rb。这将摆脱这个错误。

于 2014-03-13T08:48:20.387 回答
1

您获得的“文件路径列表”称为“堆栈跟踪”。它从顶部开始,显示发生错误的行号和文件。随后的行是调用发生错误的函数的函数,然后是调用该函数的函数,依此类推。这可以帮助您找出错误是否是由于输入错误造成的,问题是从哪里开始的。

在这种情况下,您尝试调用 Devise 引擎,但它反对您使用的名称。在这种情况下,它位于 Devise 的模型模块中。查看该模块的文档,我发现没有定义 Invitable 模块或类。你可能想看看这个问题

于 2012-09-18T01:39:13.837 回答