README.rdoc in devise-1.1.rc1 vs README.rdoc in devise-1.1.rc2
- old
+ new
@@ -11,57 +11,78 @@
* Database Authenticatable: encrypts and stores a password in the database to validate the authenticity of an user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.
* Token Authenticatable: signs in an user based on an authentication token (also known as "single access token"). The token can be given both through query string or HTTP Basic Authentication.
* Confirmable: sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
* Recoverable: resets the user password and sends reset instructions.
-* Registerable: handles signing up users through a registration process.
+* Registerable: handles signing up users through a registration process, also allowing them to edit and destroy their account.
* Rememberable: manages generating and clearing a token for remembering the user from a saved cookie.
* Trackable: tracks sign in count, timestamps and IP address.
* Timeoutable: expires sessions that have no activity in a specified period of time.
* Validatable: provides validations of email and password. It's optional and can be customized, so you're able to define your own validations.
* Lockable: locks an account after a specified number of failed sign-in attempts. Can unlock via email or after a specified time period.
-== Examples
+== Installation
-* Example application using Devise at http://github.com/plataformatec/devise_example
-* Example Rails 2.3 web app combining subdomains with Devise at http://github.com/fortuity/subdomain-authentication
+=== Rails 3 beta 4
-== Dependencies
+To use Devise with Rails 3 beta 4, please use it straight from the git repository, by adding it to your Gemfile:
-Devise is based on Warden (http://github.com/hassox/warden), a Rack Authentication Framework. You need to install Warden as a gem. Please ensure you have it installed in order to use Devise (see installation below).
+ gem "devise", :git => "git://github.com/plataformatec/devise.git"
-== Installation
+Then follow the same steps as below.
+=== Rails 3 beta 3
+
Devise master branch now supports Rails 3 and is NOT backward compatible. You can use the latest Rails 3 beta gem with Devise latest gem:
- sudo gem install devise --version=1.1.rc1
+ gem install devise --version=1.1.rc1
After you install Devise and add it to your Gemfile, you need to run the generator:
- rails generate devise_install
+ rails generate devise:install
-And you're ready to go. The generator will install an initializer which describes ALL Devise's configuration options, so be sure to take a look at it and at the documentation as well:
+The generator will install an initializer which describes ALL Devise's configuration options and you MUST take a look at it. When you are done, you are ready to add Devise to any of your models using the generator:
- http://rdoc.info/projects/plataformatec/devise
+ rails generate devise MODEL
-The documentation above is for Rails 3. If you want to consult the documentation for Rails 2.3, you need to start `gem server` in your own machine. Finally, another good resource for information, is the wiki:
+Replace MODEL by the class name you want to add devise, like User, Admin, etc. This will create a model (if one does not exist) and configure it with default Devise modules. The generator will also create a migration file (if your ORM support them) and configure your routes. Continue reading this file to understand exactly what the generator produces and how to use it.
- http://wiki.github.com/plataformatec/devise
+=== Rails 2.3
-== Rails 2.3
-
If you want to use the Rails 2.3.x version, you should do:
- sudo gem install devise --version=1.0.6
+ gem install devise --version=1.0.7
-Or checkout from the v1.0 branch:
+And please check the README at the v1.0 branch since this one is based on Rails 3:
http://github.com/plataformatec/devise/tree/v1.0
+== Ecosystem
+
+Devise ecosystem is growing solid day after day. If you just need a walkthrough about setting up Devise, this README will work great. But if you need more documentation and resources, please check both the wiki and rdoc:
+
+* http://rdoc.info/projects/plataformatec/devise
+* http://wiki.github.com/plataformatec/devise
+
+Both links above are for Devise with Rails 3. If you need to use Devise with Rails 2.3, you can always run `gem server` from the command line after you install the gem to access the old documentation.
+
+Another great way to learn Devise are Ryan Bates' screencasts:
+
+* http://railscasts.com/episodes/209-introducing-devise
+* http://railscasts.com/episodes/210-customizing-devise
+
+And a few example applications:
+
+* Rails 2.3 app using Devise at http://github.com/plataformatec/devise_example
+* Rails 2.3 app using Devise with subdomains at http://github.com/fortuity/subdomain-authentication
+* Rails 3.0 app with Mongoid at http://github.com/fortuity/rails3-mongoid-devise
+
+Finally, Devise also has several extensions built by the community. Don't forget to check them at the end of this README. If you want to write an extension on your own, you should also check Warden (http://github.com/hassox/warden), a Rack Authentication Framework which Devise depends on.
+
== 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 MUST also check out the *Generators* section below to help you start.
+This is a walkthrough with all steps you need to setup a devise resource, including model, migration, route files, and optional configuration.
Devise must be set up within the model (or models) you want to use. Devise routes must be created inside your config/routes.rb file.
We're assuming here you want a User model with some Devise modules, as outlined below:
@@ -86,17 +107,17 @@
devise_for :users
This will use your User model to create a set of needed routes (you can see them by running `rake routes`).
-Options for configuring your routes include :class_name (to set the class for that route), :path_prefix, :as and :path_names, where the last two have the same meaning as in common routes. The available :path_names are:
+Options for configuring your routes include :class_name (to set the class for that route), :path_prefix, :path and :path_names, where the last two have the same meaning as in common routes. The available :path_names are:
- devise_for :users, :as => "usuarios", :path_names => { :sign_in => 'login', :sign_out => 'logout', :sign_up => 'register', :password => 'secret', :confirmation => 'verification', :unlock => 'unblock' }
+ devise_for :users, :path => "usuarios", :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification', :unlock => 'unblock', :registration => 'register', :sign_up => 'cmon_let_me_in' }
Be sure to check devise_for documentation for details.
-After creating your models and routes, run your migrations, and you are ready to go! But don't stop reading here, we still have a lot to tell you:
+This exactly what the devise generator produces for you: model, routes and migrations. Don't forget to run rake db:migrate and you are ready to go! But don't stop reading here, we still have a lot to tell you.
== Controller filters and helpers
Devise will create some helpers to use inside your controllers and views. To set up a controller with user authentication, just add this before_filter:
@@ -131,55 +152,42 @@
# Create a migration with the required fields
create_table :admins do |t|
t.database_authenticatable
t.lockable
t.trackable
+ t.timestamps
end
# Inside your Admin model
devise :database_authenticatable, :trackable, :timeoutable, :lockable
# Inside your routes
- devise_for :admin
+ devise_for :admins
# Inside your protected controller
before_filter :authenticate_admin!
# Inside your controllers and views
admin_signed_in?
current_admin
admin_session
-== Generators
-
-Devise has generators to help you get started:
-
- rails generate devise_install
-
-This will generate an initializer, with a description of all configuration values.
-
-You can also generate models:
-
- rails generate devise Model
-
-This will create a model named "Model" configured with default Devise modules and attr_accessible set for default fields. The generator will also create the migration and configure your routes for Devise.
-
== Model configuration
The devise method in your models also accepts some options to configure its modules. For example, you can choose which encryptor to use in database_authenticatable:
devise :database_authenticatable, :confirmable, :recoverable, :encryptor => :bcrypt
-Besides :encryptor, you can define :pepper, :stretches, :confirm_within, :remember_for, :timeout_in, :unlock_in and other values. For details, see the initializer file that was created when you invoked the devise_install generator described above.
+Besides :encryptor, you can define :pepper, :stretches, :confirm_within, :remember_for, :timeout_in, :unlock_in and other values. For details, see the initializer file that was created when you invoked the "devise:install" generator described above.
== Configuring views
We built Devise to help you quickly develop an application that uses authentication. However, we don't want to be in your way when you need to customize it.
Since Devise is an engine, all its views are packaged inside the gem. These views will help you get started, but after sometime you may want to change them. If this is the case, you just need to invoke the following generator, and it will copy all views to your application:
- rails generate devise_views
+ rails generate devise:views
However, if you have more than one role in your application (such as "User" and "Admin"), you will notice that Devise uses the same views for all roles. Fortunately, Devise offers an easy way to customize views. All you need to do is set "config.scoped_views = true" inside "config/initializers/devise.rb".
After doing so, you will be able to have views based on the role like "users/sessions/new" and "admins/sessions/new". If no view is found within the scope, Devise will use the default view at "devise/sessions/new".
@@ -255,10 +263,24 @@
== Other ORMs
Devise supports ActiveRecord (by default) and Mongoid. We offer experimental Datamapper support (with the limitation that the Devise test suite does not run completely with Datamapper). To choose other ORM, you just need to configure it in the initializer file.
+== Extensions
+
+Devise also has extensions created by the community:
+
+* http://github.com/scambra/devise_invitable adds support to Devise for sending invitations by email.
+
+* http://github.com/grimen/devise_facebook_connectable adds support for Facebook Connect authentication, and optionally fetching user info from Facebook in the same step.
+
+* http://github.com/joshk/devise_imapable adds support for imap based authentication, excellent for internal apps when an LDAP server isn't available.
+
+* http://github.com/cschiewek/devise_ldap_authenticatable adds support for LDAP authentication via simple bind.
+
+Please consult their respective documentation for more information and requirements.
+
== TODO
Please refer to TODO file.
== Maintainers
@@ -266,32 +288,22 @@
* José Valim (http://github.com/josevalim)
* Carlos Antônio da Silva (http://github.com/carlosantoniodasilva)
== Contributors
-We have a long list of valued contributors. See the CHANGELOG or do `git shortlog -s -n` in the cloned repository.
+We have a long list of valued contributors. Check them all at:
-== Devise extensions
+http://github.com/plataformatec/devise/contributors
-* http://github.com/scambra/devise_invitable adds support to Devise for sending invitations by email.
-
-* http://github.com/grimen/devise_facebook_connectable adds support for Facebook Connect authentication, and optionally fetching user info from Facebook in the same step.
-
-* http://github.com/joshk/devise_imapable adds support for imap based authentication, excellent for internal apps when an LDAP server isn't available.
-
== Bugs and Feedback
If you discover any bugs, please create an issue on GitHub.
http://github.com/plataformatec/devise/issues
For support, send an e-mail to the mailing list.
http://groups.google.com/group/plataformatec-devise
-See the wiki for additional documentation and support.
-
-http://wiki.github.com/plataformatec/devise
-
== License
-MIT License. Copyright 2009 Plataforma Tecnologia. http://blog.plataformatec.com.br
+MIT License. Copyright 2010 Plataforma Tecnologia. http://blog.plataformatec.com.br