Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Undoing changes that attempted to see if I can get the collection to …

…load even when a block is given
  • Loading branch information...
commit c991c5e7e28f04e34c29c16be6898635d735c967 1 parent 43b219b
hunterae authored
Showing with 5 additions and 6 deletions.
  1. +3 −3 lib/cancan/ability.rb
  2. +2 −3 lib/cancan/controller_resource.rb
6 lib/cancan/ability.rb
View
@@ -282,9 +282,9 @@ def relevant_can_definitions_for_match(action, subject)
def relevant_can_definitions_for_query(action, subject)
relevant_can_definitions(action, subject).each do |can_definition|
- # if can_definition.only_block?
- # raise Error, "The accessible_by call cannot be used with a block 'can' definition. The SQL cannot be determined for #{action.inspect} #{subject.inspect}"
- # end
+ if can_definition.only_block?
+ raise Error, "The accessible_by call cannot be used with a block 'can' definition. The SQL cannot be determined for #{action.inspect} #{subject.inspect}"
+ end
end
end
5 lib/cancan/controller_resource.rb
View
@@ -52,9 +52,8 @@ def load_resource_instance
end
def load_collection?
- resource_base.respond_to?(:accessible_by)
- # &&
- # !current_ability.has_block?(authorization_action, resource_class)
+ resource_base.respond_to?(:accessible_by) &&
+ !current_ability.has_block?(authorization_action, resource_class)
end
def load_collection
Please sign in to comment.
Something went wrong with that request. Please try again.