cancan 1.3.3 → 1.3.4
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.
- data/CHANGELOG.rdoc +5 -0
- data/README.rdoc +1 -1
- data/lib/cancan/ability.rb +1 -1
- data/lib/cancan/can_definition.rb +1 -1
- data/spec/cancan/ability_spec.rb +8 -0
- metadata +3 -3
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
|
@@ -135,7 +135,7 @@ In the controller +index+ action you may want to fetch only the records which th
|
|
|
135
135
|
|
|
136
136
|
@articles = Article.accessible_by(current_ability)
|
|
137
137
|
|
|
138
|
-
See {Fetching Records}[http://wiki.github.com/ryanb/cancan/fetching-records] for more information.
|
|
138
|
+
This will only work when abilities are defined using hash conditions, not blocks. See {Fetching Records}[http://wiki.github.com/ryanb/cancan/fetching-records] for more information.
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
== Additional Docs
|
data/lib/cancan/ability.rb
CHANGED
|
@@ -216,7 +216,7 @@ module CanCan
|
|
|
216
216
|
def relevant_can_definitions_for_query(action, subject)
|
|
217
217
|
relevant_can_definitions(action, subject).each do |can_definition|
|
|
218
218
|
if can_definition.only_block?
|
|
219
|
-
raise Error, "
|
|
219
|
+
raise Error, "The accessible_by call cannot be used with a block 'can' definition. The SQL cannot be determined for #{action.inspect} #{subject.inspect}"
|
|
220
220
|
end
|
|
221
221
|
end
|
|
222
222
|
end
|
data/spec/cancan/ability_spec.rb
CHANGED
|
@@ -246,6 +246,14 @@ describe CanCan::Ability do
|
|
|
246
246
|
@ability.can?(:read, [[4, 5, 6]]).should be_false
|
|
247
247
|
end
|
|
248
248
|
|
|
249
|
+
it "should not stop at cannot definition when comparing class" do
|
|
250
|
+
@ability.can :read, Array
|
|
251
|
+
@ability.cannot :read, Array, :first => 1
|
|
252
|
+
@ability.can?(:read, [2, 3, 5]).should be_true
|
|
253
|
+
@ability.can?(:read, [1, 3, 5]).should be_false
|
|
254
|
+
@ability.can?(:read, Array).should be_true
|
|
255
|
+
end
|
|
256
|
+
|
|
249
257
|
it "should has eated cheezburger" do
|
|
250
258
|
lambda {
|
|
251
259
|
@ability.can? :has, :cheezburger
|
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 1
|
|
7
7
|
- 3
|
|
8
|
-
-
|
|
9
|
-
version: 1.3.
|
|
8
|
+
- 4
|
|
9
|
+
version: 1.3.4
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Ryan Bates
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date: 2010-08-
|
|
17
|
+
date: 2010-08-31 00:00:00 -07:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies: []
|
|
20
20
|
|