Permalink
Browse files

be more clear about blocks not working with accessible_by - closes #130

  • Loading branch information...
1 parent a10a38c commit 4fe44af45d94cfc275973d5e7b89fbb2443fe9cd @ryanb committed Aug 30, 2010
Showing with 2 additions and 2 deletions.
  1. +1 −1 README.rdoc
  2. +1 −1 lib/cancan/ability.rb
View
2 README.rdoc
@@ -135,7 +135,7 @@ In the controller +index+ action you may want to fetch only the records which th
@articles = Article.accessible_by(current_ability)
-See {Fetching Records}[http://wiki.github.com/ryanb/cancan/fetching-records] for more information.
+This will only work when abilities are defined using hash conditions, not blocks. See {Fetching Records}[http://wiki.github.com/ryanb/cancan/fetching-records] for more information.
== Additional Docs
View
2 lib/cancan/ability.rb
@@ -216,7 +216,7 @@ def relevant_can_definitions(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, "Cannot determine SQL conditions or joins from block for #{action.inspect} #{subject.inspect}"
+ 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

0 comments on commit 4fe44af

Please sign in to comment.