README.rdoc in devise-0.1.1 vs README.rdoc in devise-0.2.0

- old
+ new

@@ -25,11 +25,11 @@ All gems are on gemcutter, so you need to add gemcutter to your sources if you haven't yet: sudo gem sources -a http://gemcutter.org/ -Install warden gem if you don't have it installed (requires 0.5.0 or higher): +Install warden gem if you don't have it installed (requires 0.5.1 or higher): sudo gem install warden Install devise gem: @@ -42,10 +42,12 @@ And you're ready to go. == Basic Usage +This is a walkthrough with all steps you need to setup a devise resource, including model, migration, route files, and optional configuration. You can also check out the *Generators* section below to help you start. + Devise must be setted up within the model (or models) you want to use, and devise routes must be created inside your routes.rb file. We're assuming here you want a User model. First of all you have to setup a migration with the following fields: create_table :users do @@ -66,12 +68,14 @@ class User < ActiveRecord::Base devise end -This line adds devise authenticable automatically for you inside your User class. You could also include the other modules as below: +This line adds devise authenticable automatically for you inside your User class. Devise don't rely on _attr_accessible_ or _attr_protected_ inside it's modules, so be sure to setup what attributes are accessible or protected in your model. +You could also include the other devise modules as below: + # Same as using only devise, authenticable is activated by default devise :authenticable # Include authenticable + confirmable devise :confirmable @@ -164,11 +168,11 @@ map.root :controller => 'home' You also need to setup default url options for the mailer, if you are using confirmable or recoverable. It's a Rails required configuration, and you can do this inside your specific environments. Here is an example of development environment: - config.action_mailer.default_url_options = {:host => 'localhost:3000'} + config.action_mailer.default_url_options = { :host => 'localhost:3000' } Devise let's you setup as many roles as you want, so let's say you already have this User model and also want an Admin model with the same authentication stuff, but not confirmation or password recovery. Just follow the same steps: # Create a migration with the required fields create_table :admins do |t| @@ -187,10 +191,24 @@ # Inside your controllers and views admin_signed_in? current_admin admin_session +== Generators + +Devise comes with some generators to help you start: + + script/generate devise Model + +Will generate a model, configured with all devise modules, and add attr_accessible for default fields, so you can setup more accessible attributes later. The generator will also create the migration and configure your route for devise. + +You can also copy devise views to your application, being able to modify them based on your needs. To do it so, run the following command: + + script/generate devise_views + +This is gonna copy all session, password, confirmation and notifier views to your app/views folder. + == I18n Devise check for flash messages using i18n, so you're able to customize them easily. For example, to change the sign in message you should setup your locale file this way: en: @@ -224,8 +242,12 @@ Please refer to TODO file. == Bugs and Feedback -If you discover any bugs or want to drop a line, feel free to create an issue. +If you discover any bugs or want to drop a line, feel free to create an issue on +GitHub or send an e-mail to the mailing list. + +http://github.com/plataformatec/devise/issues +http://groups.google.com/group/plataformatec-devise MIT License. Copyright 2009 Plataforma Tecnologia. http://blog.plataformatec.com.br