README.md in clearance-1.4.3 vs README.md in clearance-1.5.0

- old
+ new

@@ -1,10 +1,10 @@ Clearance ========= -[![Build Status](https://secure.travis-ci.org/thoughtbot/clearance.png)](http://travis-ci.org/thoughtbot/clearance?branch=master) -[![Code Climate](https://codeclimate.com/github/thoughtbot/clearance.png)](https://codeclimate.com/github/thoughtbot/clearance) +[![Build Status](https://secure.travis-ci.org/thoughtbot/clearance.svg)](http://travis-ci.org/thoughtbot/clearance?branch=master) +[![Code Climate](https://codeclimate.com/github/thoughtbot/clearance.svg)](https://codeclimate.com/github/thoughtbot/clearance) Rails authentication with email & password. Clearance was extracted out of [Airbrake](http://airbrake.io/). It is intended to be small, simple, and well-tested. It is intended to be easy to override @@ -58,10 +58,11 @@ Clearance.configure do |config| config.allow_sign_up = true config.cookie_domain = '.example.com' config.cookie_expiration = lambda { |cookies| 1.year.from_now.utc } config.cookie_path = '/' + config.routes = true config.httponly = false config.mailer_sender = 'reply@example.com' config.password_strategy = Clearance::PasswordStrategies::BCrypt config.redirect_url = '/' config.secure_cookie = false @@ -149,18 +150,22 @@ ``` Overriding routes ----------------- -See [config/routes.rb](/config/routes.rb) for the default behavior. +See [config/routes.rb](/config/routes.rb) for the default set of routes. -To override a Clearance route, redefine it: +Route overrides became more difficult with [changes made in Rails +4][rails_routes]. For this reason, Clearance 1.5 introduces an option to disable +all clearance routes, giving the user full control over routing and URL design. -```ruby -resource :session, controller: 'sessions' -``` +To disable the routes, set `config.routes = false`. You can optionally run +`rails generate clearance:routes` to dump a copy of the default routes into your +application for modification. +[rails_routes]: https://github.com/rails/rails/issues/11895 + Overriding controllers ---------------------- See [app/controllers/clearance](/app/controllers/clearance) for the default behavior. @@ -171,11 +176,11 @@ class PasswordsController < Clearance::PasswordsController class SessionsController < Clearance::SessionsController class UsersController < Clearance::UsersController ``` -Don't forget to override routes to your new controllers! +Don't forget to [override routes](#overriding-routes) to your new controllers! Then, override public methods: passwords#create passwords#edit @@ -229,9 +234,22 @@ [i18n translations](http://guides.rubyonrails.org/i18n.html). Override them like any other translation. See [config/locales/clearance.en.yml](/config/locales/clearance.en.yml) for the default behavior. + +Overriding layouts +---------------- + +By default, Clearance uses your application's default layout. If you would like +to change the layout that Clearance uses when rendering its views, simply specify +the layout in an initializer. + +```ruby +Clearance::PasswordsController.layout 'my_passwords_layout' +Clearance::SessionsController.layout 'my_sessions_layout' +Clearance::UsersController.layout 'my_admin_layout' +``` Overriding views ---------------- See [app/views](/app/views) for the default behavior.