Devise Generators in Rails – A Tip.

If you’re ever developed with Rails you’ll be aware how things evolve very quickly. Restful_authentication used to be the plugin of choice if you didn’t want to roll your own authentication code but this has been superseded by Devise, a Warden based Gem.

You can get up and running within minutes and have full featured authentication in place (including all of the functionality for resetting passwords, generating confirmation emails etc). The beauty of Devise lies is its flexibility – you can activate only the modules you need and its readily extensible.

There are some nice tutorials available on Railscasts, but depending on the version you are using, some of the generator code doesn’t seem to work. If you’re having difficulty following the generator instructions like:

  • rails generate devise_install
  • rails generate devise_views

and get an error like “Could not find generator devise_views.”, just replace the underscores with colons:

  • rails generate devise:install
  • rails generate devise:views

Might save you some time trying to figure out what you’ve done wrong.

Posted on in Rails
Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. a friend
    Posted October 2, 2011 at 1:15 pm | Permalink

    Thanks a lot man, you saved me a lot of trouble.

  2. Posted December 6, 2011 at 11:50 pm | Permalink

    Many thanks. I had the same problem!

  3. mauro
    Posted January 12, 2012 at 5:04 pm | Permalink

    i love you so much!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>