title: undefined method 'devise' for User
body: <p>I have been looking to get to grips with devise and its workings and have kind of fallen at the first hurdle.  I have looked in a few places but cannot seem to find someone with this error exactly.</p>
  
  <p>So I have created a simple Home controller with an index view and added root 'home#index' and also ensured the default url options are setup in the development.rb file.  I then simply typed:</p>
  
  <pre><code>rails generate devise User
  </code></pre>
  
  <p>This created my user.rb file in models with the following:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    # Include default devise modules. Others available are:
    # :confirmable, :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable, :registerable,
           :recoverable, :rememberable, :trackable, :validatable
  end
  </code></pre>
  
  <p>Pretty straightforward so far, I have the following Gemfile:</p>
  
  <pre><code>source 'https://rubygems.org'
  gem 'rails', '4.0.5'
  gem 'sqlite3'
  gem 'sass-rails', '~&gt; 4.0.2'
  gem 'devise'
  gem 'uglifier', '&gt;= 1.3.0'
  gem 'coffee-rails', '~&gt; 4.0.0'
  gem 'jquery-rails'
  gem 'turbolinks'
  gem 'jbuilder', '~&gt; 1.2'
  group :doc do
    gem 'sdoc', require: false
  end
  gem 'bcrypt'
  </code></pre>
  
  <p>And when I run either rake db:migrate I get the following error:</p>
  
  <pre><code>rake aborted!
  NoMethodError: undefined method `devise' for User (call 'User.connection' to establish a connection):Class
  /home/jonlee/.rvm/gems/ruby-2.1.1@railstutorial_rails_4_0/gems/activerecord-4.0.5/lib/active_record/dynamic_matchers.rb:22:in `method_missing'
  /home/jonlee/Projects/rails/userauth/app/models/user.rb:4:in `&lt;class:User&gt;'
  /home/jonlee/Projects/rails/userauth/app/models/user.rb:1:in `&lt;top (required)&gt;'
  </code></pre>
  
  <p>Im at a loss as to why the User model cannot find the 'devise' method when as far as I can see it is definitely there.</p>
  
  <p>I get similar errors with rake routes, rails server and rails console.</p>
  
  <p>For further info I am using ruby 2.1.1 if that helps?</p>