lib/authoreyes/railtie.rb in authoreyes-0.2.0 vs lib/authoreyes/railtie.rb in authoreyes-0.2.1

- old
+ new

@@ -28,11 +28,15 @@ end # Controller integration initializer 'authoreyes.in_controller' do |app| ActiveSupport.on_load :action_controller do - before_action :redirect_if_unauthorized - after_action :set_unauthorized_status_code + if Rails.application.config.api_only + before_action :render_unauthorized + else + before_action :redirect_if_unauthorized + after_action :set_unauthorized_status_code + end end end # Set up the Authoreyes ENGINE initializer 'authoreyes.engine' do |app|