cancan 1.5.0.beta1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/CHANGELOG.rdoc +1 -1
  2. data/README.rdoc +13 -22
  3. metadata +4 -5
data/CHANGELOG.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- 1.5.0 (not yet released)
1
+ 1.5.0 (January 11, 2011)
2
2
 
3
3
  * Added an Ability generator - see issue #170
4
4
 
data/README.rdoc CHANGED
@@ -22,25 +22,15 @@ Alternatively, you can install it as a plugin.
22
22
 
23
23
  == Getting Started
24
24
 
25
- CanCan expects a +current_user+ method to exist in controllers. If you have not already, set up some authentication (such as Authlogic[https://github.com/binarylogic/authlogic] or Devise[https://github.com/plataformatec/devise]). See {Changing Defaults}[https://github.com/ryanb/cancan/wiki/changing-defaults] if you need different behavior.
25
+ CanCan expects a +current_user+ method to exist in controllers. First, set up some authentication (such as Authlogic[https://github.com/binarylogic/authlogic] or Devise[https://github.com/plataformatec/devise]). See {Changing Defaults}[https://github.com/ryanb/cancan/wiki/changing-defaults] if you need to customize this behavior.
26
26
 
27
- Next create a class called +Ability+ in "models/ability.rb" or anywhere else in the load path. It should look similar to this.
27
+ Next, make an +Ability+ class. CanCan 1.5 includes a generator for this.
28
28
 
29
- class Ability
30
- include CanCan::Ability
29
+ rails g cancan:ability
31
30
 
32
- def initialize(user)
33
- if user.admin?
34
- can :manage, :all
35
- else
36
- can :read, :all
37
- end
38
- end
39
- end
40
-
41
- The +current_user+ is passed in to this method which is where the abilities are defined. See {Defining Abilities}[https://github.com/ryanb/cancan/wiki/defining-abilities] for what can go here.
31
+ This is where the user permission will be defined. See the comments in models/ability.rb and {Defining Abilities}[https://github.com/ryanb/cancan/wiki/defining-abilities] for details.
42
32
 
43
- The current user's permissions can then be accessed using the "can?" and "cannot?" methods in the view and controller.
33
+ The current user's permissions can then be checked using the <tt>can?</tt> and <tt>cannot?</tt> methods in the view and controller.
44
34
 
45
35
  <% if can? :update, @article %>
46
36
  <%= link_to "Edit", edit_article_path(@article) %>
@@ -65,7 +55,7 @@ Setting this for every action can be tedious, therefore the +load_and_authorize_
65
55
  end
66
56
  end
67
57
 
68
- See {Authorizing Controller Actions}[https://github.com/ryanb/cancan/wiki/authorizing-controller-actions] for more information
58
+ See {Authorizing Controller Actions}[https://github.com/ryanb/cancan/wiki/authorizing-controller-actions] for more information.
69
59
 
70
60
  If the user authorization fails, a <tt>CanCan::AccessDenied</tt> exception will be raised. You can catch this and modify its behavior in the +ApplicationController+.
71
61
 
@@ -79,13 +69,14 @@ If the user authorization fails, a <tt>CanCan::AccessDenied</tt> exception will
79
69
  See {Exception Handling}[https://github.com/ryanb/cancan/wiki/exception-handling] for more information.
80
70
 
81
71
 
82
- == Additional Docs
72
+ == Wiki Docs
83
73
 
84
- * {Upgrading to 1.4}[https://github.com/ryanb/cancan/wiki/Upgrading-to-1.4]
85
- * {Nested Resources}[https://github.com/ryanb/cancan/wiki/nested-resources]
86
- * {Testing Abilities}[https://github.com/ryanb/cancan/wiki/testing-abilities]
87
- * {Accessing Request Data}[https://github.com/ryanb/cancan/wiki/accessing-request-data]
88
- * {Admin Namespace}[https://github.com/ryanb/cancan/wiki/admin-namespace]
74
+ * {Upgrading to 1.5}[https://github.com/ryanb/cancan/wiki/Upgrading-to-1.5]
75
+ * {Defining Abilities}[https://github.com/ryanb/cancan/wiki/Defining-Abilities]
76
+ * {Checking Abilities}[https://github.com/ryanb/cancan/wiki/Checking-Abilities]
77
+ * {Authorizing Controller Actions}[https://github.com/ryanb/cancan/wiki/Authorizing-Controller-Actions]
78
+ * {Exception Handling}[https://github.com/ryanb/cancan/wiki/Exception-Handling]
79
+ * {Changing Defaults}[https://github.com/ryanb/cancan/wiki/Changing-Defaults]
89
80
  * {See more}[https://github.com/ryanb/cancan/wiki]
90
81
 
91
82
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cancan
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1848230027
5
- prerelease: true
4
+ hash: 3
5
+ prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
9
  - 0
10
- - beta1
11
- version: 1.5.0.beta1
10
+ version: 1.5.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - Ryan Bates
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2011-01-08 00:00:00 -08:00
18
+ date: 2011-01-11 00:00:00 -08:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency