1

I have followed the #209 tutorial of railscast http://railscasts.com/episodes/209-introducing-devise?view=asciicast. It was working good until I tried to generate the devise views to customize it (tutorial #210 of railscast)

I did :

rails generate devise:views
rails generate devise_views

Got the following error :

NameError: uninitialized constant View

I am using rails 3.1.3, & devise 1.4.7 with warden 1.0.6. Any ideas ?

Tks Matt

matthughs
  • 37
  • 1
  • 6

2 Answers2

8

I ran into this issue myself. I accidentally typed rails g devise views which actually created a new model for devise, and added routes for them. I deleted all of the files that were created, then corrected myself and typed rails g devise:views and started getting your exact error.

After a bit of head scratching I ran a git diff to see if anything else was different, and indeed it had added a route for "views". Upon deleting that route, and running rails g devise:views again, all was well!

Hope this helps!

counterbeing
  • 2,721
  • 2
  • 27
  • 47
  • hello @counterbeing - thank you for your help: i made the same mistake as you did, i ran rails d devise views to get rid of it all, and now when i sign up a new user i get the same error. any advice would be much appreciated. – BenKoshy Jul 07 '16 at 01:01
  • Definitely worth checking your version control (git?) to see if there are files you don't expect to be there. Also, i've never heard of a `rails d` command. I know there's a `-d` flag, but it's used to indicate a database type in new projects. Double check the docs on that one... I just looked at `rails --help` and it makes no mention of it there. But, version control is a good bet, assuming you're using it. Good luck! – counterbeing Jul 07 '16 at 05:45
0

You can find out a list of all the generators by running rails generate or rails g

The correct generator is:

rails g devise:views

I can only think that you are having some sort of version conflict.

Does the following work:

bundle exec rails g devise:views

If not, have you already run:

rails g devise:install
rails g devise User
Gazler
  • 83,029
  • 18
  • 279
  • 245
  • Tks Gazler.I tried all your command lines but always the same : NameError: uninitialized constant View. The think is that devise sign up,in,out system is working good. – matthughs Jan 16 '12 at 23:05