Skip to content

Commit

Permalink
Update ApplicationController to allow API requests (nanego#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
B-Rass authored Oct 18, 2023
1 parent ce7fce6 commit f1aacca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class ApplicationController < ActionController::Base

# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
protect_from_forgery with: :exception, unless: -> { request.format.json? }
protect_from_forgery with: :null_session, if: -> { request.format.json? }

rescue_from ActiveRecord::RecordNotFound, with: :show_not_found_error

Expand Down

0 comments on commit f1aacca

Please sign in to comment.