README.md in devise-2.0.6 vs README.md in devise-2.1.0.rc

- old
+ new

@@ -1,6 +1,6 @@ -*IMPORTANT:* Devise 2.0.0 is out. If you are upgrading, please read: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0 +*IMPORTANT:* Devise 2.0 is out. If you are upgrading, please read: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0 ## Devise INFO: This README is [also available in a friendly navigable format](http://devise.plataformatec.com.br/). @@ -107,10 +107,12 @@ rails generate devise MODEL ``` Replace MODEL by the class name used for the applications users, it's frequently 'User' but could also be 'Admin'. This will create a model (if one does not exist) and configure it with default Devise modules. Next, you'll usually run "rake db:migrate" as the generator will have created a migration file (if your ORM supports them). This generator also configures your config/routes.rb file to point to Devise controller. +Note that you should re-start your app here if you've already started it. Otherwise you'll run into strange errors like users being unable to login and the route helpers being undefined. + ### 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: ```ruby @@ -133,17 +135,17 @@ ```ruby user_session ``` -After signing in a user, confirming the account or updating the 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. This means that you need to set the root inside your routes: +After signing in a user, confirming the account or updating the 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. This means that you need to set the root inside your routes: ```ruby root :to => "home#index" ``` -You can also overwrite +after_sign_in_path_for+ and +after_sign_out_path_for+ to customize your redirect hooks. +You can also overwrite `after_sign_in_path_for` and `after_sign_out_path_for` to customize your redirect hooks. Finally, you need to set up default url options for the mailer in each environment. Here is the configuration for "config/environments/development.rb": ```ruby config.action_mailer.default_url_options = { :host => 'localhost:3000' } @@ -245,30 +247,22 @@ ```ruby 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. +Be sure to check `devise_for` documentation for details. -If you have the need for more deep customization, for instance to also allow "/sign_in" besides "/users/sign_in", all you need to do is to create your routes normally and wrap them in a +devise_scope+ block in the router: +If you have the need for more deep customization, for instance to also allow "/sign_in" besides "/users/sign_in", all you need to do is to create your routes normally and wrap them in a `devise_scope` block in the router: ```ruby devise_scope :user do get "sign_in", :to => "devise/sessions#new" end ``` -This way you tell devise to use the scope :user when "/sign_in" is accessed. Notice +devise_scope+ is also aliased as +as+ and you can also give a block to +devise_for+, resulting in the same behavior: +This way you tell devise to use the scope :user when "/sign_in" is accessed. Notice `devise_scope` is also aliased as `as` in your router. -```ruby -devise_for :users do - get "sign_in", :to => "devise/sessions#new" -end -``` - -Feel free to choose the one you prefer! - ### I18n Devise uses flash messages with I18n with the flash keys :notice and :alert. To customize your app, you can set up your locale file: ```yaml @@ -325,10 +319,10 @@ class ActionController::TestCase include Devise::TestHelpers end ``` -If you're using RSpec and want the helpers automatically included within all +describe+ blocks, add a file called spec/support/devise.rb with the following contents: +If you're using RSpec and want the helpers automatically included within all `describe` blocks, add a file called spec/support/devise.rb with the following contents: ```ruby RSpec.configure do |config| config.include Devise::TestHelpers, :type => :controller end