Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb8e9bde57 | ||
|
|
89e40987d8 | ||
|
|
1ac8099f7a |
@@ -1,3 +1,10 @@
|
|||||||
|
1.6.3 (March 25, 2011)
|
||||||
|
|
||||||
|
* Make sure ActiveRecord::Relation is defined before checking conditions against it so Rails 2 is supported again - see issue #312
|
||||||
|
|
||||||
|
* Return subject passed to authorize! - see issue #314
|
||||||
|
|
||||||
|
|
||||||
1.6.2 (March 18, 2011)
|
1.6.2 (March 18, 2011)
|
||||||
|
|
||||||
* Fixed instance loading when :singleton option is used - see issue #310
|
* Fixed instance loading when :singleton option is used - see issue #310
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "cancan"
|
s.name = "cancan"
|
||||||
s.version = "1.6.2"
|
s.version = "1.6.3"
|
||||||
s.author = "Ryan Bates"
|
s.author = "Ryan Bates"
|
||||||
s.email = "ryan@railscasts.com"
|
s.email = "ryan@railscasts.com"
|
||||||
s.homepage = "http://github.com/ryanb/cancan"
|
s.homepage = "http://github.com/ryanb/cancan"
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ module CanCan
|
|||||||
message ||= unauthorized_message(action, subject)
|
message ||= unauthorized_message(action, subject)
|
||||||
raise AccessDenied.new(message, action, subject)
|
raise AccessDenied.new(message, action, subject)
|
||||||
end
|
end
|
||||||
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
def unauthorized_message(action, subject)
|
def unauthorized_message(action, subject)
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ module CanCan
|
|||||||
|
|
||||||
def override_scope
|
def override_scope
|
||||||
conditions = @rules.map(&:conditions).compact
|
conditions = @rules.map(&:conditions).compact
|
||||||
if conditions.any? { |c| c.kind_of?(ActiveRecord::Relation) }
|
if defined?(ActiveRecord::Relation) && conditions.any? { |c| c.kind_of?(ActiveRecord::Relation) }
|
||||||
if conditions.size == 1
|
if conditions.size == 1
|
||||||
conditions.first
|
conditions.first
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -317,9 +317,11 @@ describe CanCan::Ability do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should not raise access denied exception if ability is authorized to perform an action" do
|
it "should not raise access denied exception if ability is authorized to perform an action and return subject" do
|
||||||
@ability.can :read, :foo
|
@ability.can :read, :foo
|
||||||
lambda { @ability.authorize!(:read, :foo) }.should_not raise_error
|
lambda {
|
||||||
|
@ability.authorize!(:read, :foo).should == :foo
|
||||||
|
}.should_not raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should know when block is used in conditions" do
|
it "should know when block is used in conditions" do
|
||||||
|
|||||||
Reference in New Issue
Block a user