Skip to content

Commit

Permalink
Fix requiring devise mapping, and adding some documentation about rou…
Browse files Browse the repository at this point in the history
…tes and mailer setup.
  • Loading branch information
carlosantoniodasilva committed Oct 21, 2009
1 parent fcea586 commit 6f450d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
15 changes: 13 additions & 2 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ Install warden gem if you don't have it installed (requires 0.5.0 or higher):

sudo gem install warden

Install devise inside your app:
Install devise gem:

sudo gem install devise

Configure warden and devise gems inside your app:

config.gem 'warden'
config.gem 'devise'

And you're ready to go.

== Basic Usage
Expand Down Expand Up @@ -155,7 +160,13 @@ You have also access to the session for this scope:

user_session

After signing in a user, confirming it's account or updating it's password, devise will look for a scoped root path to redirect. Example: For a :user resource, it will use user_root_path if it exists, otherwise default root_path will be used.
After signing in a user, confirming it's account or updating it's password, devise will look for a scoped root path to redirect. Example: For a :user resource, it will use user_root_path if it exists, otherwise default root_path will be used. To do it so, you need to create e default root inside your routes for your application:

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'}

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:

Expand Down
1 change: 1 addition & 0 deletions lib/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ def #{accessor}
end

require 'devise/warden'
require 'devise/mapping'
require 'devise/routes'

0 comments on commit 6f450d7

Please sign in to comment.