Module: AccessForge::ControllerHelpers
- Defined in:
- lib/access_forge/controller_helpers.rb
Instance Method Summary collapse
Instance Method Details
#authorize_user! ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/access_forge/controller_helpers.rb', line 5 def policy = policy_class.new(current_user, self) return if policy.send("#{action_name}?") render json: { error: "You are not authorized to perform this action" }, status: :unauthorized end |
#policy_class ⇒ Object
13 14 15 |
# File 'lib/access_forge/controller_helpers.rb', line 13 def policy_class "#{controller_name.classify}Policy".constantize end |