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

This commit is contained in:
Ryan Bates 2010-08-30 13:40:31 -07:00
parent a10a38c82f
commit 4fe44af45d
2 changed files with 2 additions and 2 deletions

View File

@ -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 File

@ -216,7 +216,7 @@ module CanCan
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