Rails Generator Gotcha

Note to self:

Remove devise_for in routes.rb if you’re trying to generate a scaffold of an already existing model.

Steps to replicate:

  1. rails g model Foo name
  2. rails g devise Foo
  3. rails g scaffold Foo –skip
    1. This would result with the error: The name ‘Foo’ is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again.

Commenting the devise_for line in routes.rb will allow you to proceed with the scaffold.