README.md in clearance-0.11.1 vs README.md in clearance-0.11.2

- old
+ new

@@ -15,11 +15,11 @@ * [Mailing list](http://groups.google.com/group/thoughtbot-clearance) at Google Groups. Installation ------------ -Clearance is a Rails engine for Rails 3. +Clearance is a Rails engine for Rails 3. It is currently tested against Rails 3.0.9 and Rails 3.1.0.rc4. Include the gem in your Gemfile: gem "clearance" @@ -31,10 +31,12 @@ * inserts Clearance::User into your User model * inserts Clearance::Authentication into your ApplicationController * creates a migration that either creates a users table or adds only missing columns +Follow the instructions that are output from the generator. + Use the [0.8.x](https://github.com/thoughtbot/clearance/tree/v0.8.8) series of Clearance if you have a Rails 2 app. Usage ----- @@ -42,24 +44,34 @@ If you want to authorize users for a controller action, use the authorize method in a before_filter. class WidgetsController < ApplicationController before_filter :authorize + def index @widgets = Widget.all end end +If you want to reference the current user in a controller, view, or helper, use +the current_user method. + + def index + current_user.articles + end + Customizing ----------- -To change any of provided actions, subclass a Clearance controller... +If you ever need to change the logic in any of the four provided controllers, +subclass the Clearance controller. You don't need to do this by default. class SessionsController < Clearance::SessionsController def new # my special new action end + def url_after_create my_special_path end end @@ -93,9 +105,18 @@ config.action_mailer.default_url_options = { :host => 'localhost:3000' } Then run your tests! rake + +Optional test matchers +---------------------- + +Clearance comes with test matchers that are compatible with RSpec and Test::Unit. + +To use them, require the test matchers. For example, in spec/support/clearance.rb: + + require 'clearance/shoulda_matchers' Extensions ---------- Clearance is intended to be small, simple, well-tested, and easy to extend.