user3491205
user3491205

Reputation: 69

why is my "rails generate devise User" and "rails generate devise_install" giving me the following error?

/usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.19/lib/active_support/inflector/methods.rb:124:in `block in constantize': uninitialized constant User (NameError)

I have a users table already in the DB so Im wondering how to fix this problem

Upvotes: 2

Views: 1381

Answers (1)

Dan
Dan

Reputation: 173

Devise should have created the User model for you. It sounds like this did not happen. Try creating the model, something like this...

class User < ActiveRecord::Base
  devise :database_authenticatable, :registerable,
    :recoverable, :rememberable, :trackable, :validatable
end

I would advise against scaffolding the User.

If you need to get the view files, run

rails g devise:views

If you need the controllers (for extending and such) you can reference them here

https://github.com/plataformatec/devise/tree/master/app/controllers/devise

and just create a devise directory within controllers and place the needed controller files within from devise.

Hope this helps.

Upvotes: 0

Related Questions