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.
@@ -1,3 +1,8 @@
1
+ 1.3.4 (August 31, 2010)
2
+
3
+ * Don't stop at +cannot+ with hash conditions when checking class (thanks tamoya) - see issue #131
4
+
5
+
1
6
  1.3.3 (August 20, 2010)
2
7
 
3
8
  * Switching to Rspec namespace to remove deprecation warning in Rspec 2 - see issue #119
@@ -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
@@ -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, "Cannot determine SQL conditions or joins from block for #{action.inspect} #{subject.inspect}"
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
@@ -30,7 +30,7 @@ module CanCan
30
30
  elsif @conditions.kind_of?(Hash) && subject.class != Class
31
31
  matches_conditions_hash?(subject)
32
32
  else
33
- true
33
+ @base_behavior
34
34
  end
35
35
  end
36
36
 
@@ -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
- - 3
9
- version: 1.3.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-20 00:00:00 -07:00
17
+ date: 2010-08-31 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20