lib/authoreyes/helpers/in_controller.rb in authoreyes-0.2.2 vs lib/authoreyes/helpers/in_controller.rb in authoreyes-0.2.3
- old
+ new
@@ -19,11 +19,11 @@
ActionController::Base.send(:define_method, :redirect_if_unauthorized) do
begin
permitted_to! action_name
rescue Authoreyes::Authorization::NotAuthorized => e
session[:request_unauthorized] = true
- puts e
+ Rails.logger.warn "[Authoreyes] #{e}"
redirect_back fallback_location: root_path,
status: :found,
alert: 'You are not allowed to do that.'
end
end
@@ -36,10 +36,10 @@
end
ActionController::Metal.send(:define_method, :authorization_object) do
if params[:id].present?
begin
- controller_name.singularize.capitalize.constantize.find(params[:id])
+ controller_name.singularize.camelcase.capitalize.constantize.find(params[:id])
rescue NameError
logger.warn '[Authoreyes] Could not interpolate object!'
end
end
end