Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when launching rails server - getting "uninitialized constant Devise::Models::Invitable (NameError)"

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

like image 655
pvskisteak5 Avatar asked Sep 18 '12 00:09

pvskisteak5


2 Answers

You need to add:

require 'devise_invitable'

to config/initializers/devise.rb. That will get rid of this error.

like image 178
Phitherek_ Avatar answered Oct 23 '22 00:10

Phitherek_


The "list of file paths" you got is called a "stack trace." It starts at the top showing the line number and file where the error occurred. Subsequent lines are the function which was calling the function where the error occurred, then the function which called that, and so on. That helps you figure out, if the error was due to bad input, where the trouble began.

In this case, you're trying to call in to the Devise engine, and it's objecting to a name you used. In this case, it's in Devise's Models module. Looking at the documentation for that module, I see that there is no Invitable module or class defined. You might want to look at this question.

like image 27
pjmorse Avatar answered Oct 23 '22 02:10

pjmorse