cancan 1.6.2 → 1.6.3

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,10 @@
1
+ 1.6.3 (March 25, 2011)
2
+
3
+ * Make sure ActiveRecord::Relation is defined before checking conditions against it so Rails 2 is supported again - see issue #312
4
+
5
+ * Return subject passed to authorize! - see issue #314
6
+
7
+
1
8
  1.6.2 (March 18, 2011)
2
9
 
3
10
  * Fixed instance loading when :singleton option is used - see issue #310
@@ -201,6 +201,7 @@ module CanCan
201
201
  message ||= unauthorized_message(action, subject)
202
202
  raise AccessDenied.new(message, action, subject)
203
203
  end
204
+ subject
204
205
  end
205
206
 
206
207
  def unauthorized_message(action, subject)
@@ -99,7 +99,7 @@ module CanCan
99
99
 
100
100
  def override_scope
101
101
  conditions = @rules.map(&:conditions).compact
102
- if conditions.any? { |c| c.kind_of?(ActiveRecord::Relation) }
102
+ if defined?(ActiveRecord::Relation) && conditions.any? { |c| c.kind_of?(ActiveRecord::Relation) }
103
103
  if conditions.size == 1
104
104
  conditions.first
105
105
  else
@@ -317,9 +317,11 @@ describe CanCan::Ability do
317
317
  end
318
318
  end
319
319
 
320
- it "should not raise access denied exception if ability is authorized to perform an action" do
320
+ it "should not raise access denied exception if ability is authorized to perform an action and return subject" do
321
321
  @ability.can :read, :foo
322
- lambda { @ability.authorize!(:read, :foo) }.should_not raise_error
322
+ lambda {
323
+ @ability.authorize!(:read, :foo).should == :foo
324
+ }.should_not raise_error
323
325
  end
324
326
 
325
327
  it "should know when block is used in conditions" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cancan
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
5
- prerelease: false
4
+ hash: 9
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
- - 2
10
- version: 1.6.2
9
+ - 3
10
+ version: 1.6.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Bates
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-18 00:00:00 -07:00
18
+ date: 2011-03-25 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  requirements: []
162
162
 
163
163
  rubyforge_project: cancan
164
- rubygems_version: 1.3.7
164
+ rubygems_version: 1.4.2
165
165
  signing_key:
166
166
  specification_version: 3
167
167
  summary: Simple authorization solution for Rails.