Permalink
Browse files

adding a couple things to the changelog

  • Loading branch information...
1 parent 18b45d5 commit b0cec5251cd872423070b4c00408c647804b56c3 @ryanb committed Oct 5, 2010
View
@@ -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
View
@@ -224,7 +224,7 @@ def attributes_for(action, subject)
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 @@ def relevant_can_definitions(action, subject)
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 @@ def tableized_conditions(conditions = @conditions)
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 @@ class A; include B; end
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 @@
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 {

0 comments on commit b0cec52

Please sign in to comment.