README.md in consul-0.11.2 vs README.md in consul-0.12.0
- old
+ new
@@ -1,16 +1,18 @@
-Consul - A next gen authorization solution
+Consul — A next gen authorization solution
==========================================
[](https://travis-ci.org/makandra/consul) [](https://codeclimate.com/github/makandra/consul)
-Consul is a authorization solution for Ruby on Rails where you describe *sets of accessible things* to control what a user can see or edit.
+Consul is an authorization solution for Ruby on Rails where you describe *sets of accessible things* to control what a user can see or edit.
We have used Consul in combination with [assignable_values](https://github.com/makandra/assignable_values) to solve a variety of authorization requirements ranging from boring to bizarre.
Also see our crash course video: [Solving bizare authorization requirements with Rails](http://bizarre-authorization.talks.makandra.com/).
+Consul is tested with Rails 2.3, 3.0, 3.2 and 4.1 on Ruby 1.8.7, 1.9.3 and 2.1.0.
+
Describing access to your application
-------------------------------------
You describe access to your application by putting a `Power` model into `app/models/power.rb`.
Inside your `Power` you can talk about what is accessible for the current user, e.g.
@@ -80,11 +82,11 @@
power.notes? # => returns true if Power#notes returns a scope and not nil
Or you can raise an error unless a power its given, e.g. to guard access into a controller action:
- power.notes? # => returns true if Power#notes returns a scope, even if it's empty
+ power.notes! # => raises Consul::Powerless unless Power#notes returns a scope (even if it's empty)
Or you ask whether a given record is included in its scope (can be [optimized](#optimizing-record-checks-for-scope-powers)):
power.note?(Note.last) # => returns whether the given Note is in the Power#notes scope. Caches the result for subsequent queries.
@@ -359,10 +361,10 @@
You can use `:except` and `:only` options like in before filters.
You can also map different powers to different actions:
class NotesController < ApplicationController
- power :notes, :map => { [:edit, :update, :destroy] => :changable_notes }
+ power :notes, :map => { [:edit, :update, :destroy] => :changeable_notes }
end
Actions that are not listed in `:map` will get the default action `:notes`.
Note that in moderately complex authorization scenarios you will often find yourself writing a map like this: