Skip to content

Commit

Permalink
Avoid call to current_user in AuthorizationInController#permitted_to*
Browse files Browse the repository at this point in the history
when :user option is passed.
  • Loading branch information
tovodeverett committed Dec 10, 2012
1 parent 94a28ed commit a051d11
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/declarative_authorization/in_controller.rb
Expand Up @@ -176,11 +176,12 @@ def options_for_permit (object_or_sym = nil, options = {}, bang = true)
object = object_or_sym
end

{:user => current_user,
:object => object,
result = {:object => object,
:context => context,
:skip_attribute_test => object.nil?,
:bang => bang}.merge(options)
result[:user] = current_user unless result.key?(:user)
result
end

module ClassMethods
Expand Down

0 comments on commit a051d11

Please sign in to comment.