Skip to content

Commit

Permalink
Fixing auth on relations.
Browse files Browse the repository at this point in the history
  • Loading branch information
bamnet committed Jul 7, 2012
1 parent 7d0e6ac commit 676acd0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def auth!(options = {})
end
object = (options[:object] || instance_variable_get("@#{var_name}"))

if allow_empty && (object.is_a? Enumerable)
if allow_empty && ((object.is_a? Enumerable) || (object.is_a? ActiveRecord::Relation))
object.delete_if {|o| cannot?(test_action, o)}
else
if cannot?(test_action, object)
Expand Down

0 comments on commit 676acd0

Please sign in to comment.