adding a couple things to the changelog
This commit is contained in:
parent
18b45d5cfc
commit
b0cec5251c
|
@ -1,5 +1,9 @@
|
|||
1.4.0 (not yet released)
|
||||
|
||||
* Adding Gemfile; to get specs running just +bundle+ and +rake+ - see issue #163
|
||||
|
||||
* Stop at 'cannot' definition when there are no conditions - see issue #161
|
||||
|
||||
* The :through option will now call a method with that name if instance variable doesn't exist - see issue #146
|
||||
|
||||
* Adding :shallow option to load_resource to bring back old behavior of fetching a child without a parent
|
||||
|
|
|
@ -224,7 +224,7 @@ module CanCan
|
|||
def has_block?(action, subject)
|
||||
relevant_can_definitions(action, subject).any?(&:only_block?)
|
||||
end
|
||||
|
||||
|
||||
def has_raw_sql?(action, subject)
|
||||
relevant_can_definitions(action, subject).any?(&:only_raw_sql?)
|
||||
end
|
||||
|
@ -271,7 +271,7 @@ module CanCan
|
|||
can_definition.relevant? action, subject
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def relevant_can_definitions_for_match(action, subject)
|
||||
relevant_can_definitions(action, subject).each do |can_definition|
|
||||
if can_definition.only_raw_sql?
|
||||
|
|
|
@ -56,7 +56,7 @@ module CanCan
|
|||
def only_block?
|
||||
conditions_empty? && !@block.nil?
|
||||
end
|
||||
|
||||
|
||||
def only_raw_sql?
|
||||
@block.nil? && !conditions_empty? && !@conditions.kind_of?(Hash)
|
||||
end
|
||||
|
|
|
@ -324,7 +324,7 @@ describe CanCan::Ability do
|
|||
end
|
||||
@ability.should have_block(:read, :foo)
|
||||
end
|
||||
|
||||
|
||||
it "should know when raw sql is used in conditions" do
|
||||
@ability.can :read, :foo
|
||||
@ability.should_not have_raw_sql(:read, :foo)
|
||||
|
|
|
@ -56,14 +56,14 @@ describe CanCan::ActiveRecordAdditions do
|
|||
stub(@model_class).scoped{|*args| args.inspect}
|
||||
@model_class.accessible_by(@ability).should == :found_records
|
||||
end
|
||||
|
||||
|
||||
it "should not allow to fetch records when ability with just block present" do
|
||||
@ability.can :read, @model_class do false end
|
||||
lambda {
|
||||
@model_class.accessible_by(@ability)
|
||||
}.should raise_error(CanCan::Error)
|
||||
end
|
||||
|
||||
|
||||
it "should not allow to check ability on object when nonhash sql ability definition without block present" do
|
||||
@ability.can :read, @model_class, ['bar = ?', 1]
|
||||
lambda {
|
||||
|
|
Loading…
Reference in New Issue
Block a user