У меня есть приложение rails, которое я планирую обновить до рельсов 5. Я использую devise (v4.2.0) вместе с рельсами (v5.0.0). Как было предложено в DEViSE README.md файл, я попытался перемещение protect_from_forgery над before_filter, но до сих пор, когда я пытаюсь войти в систему или обновить ошибку я получаю сообщение об ошибке ActionController::InvalidAuthenticityToken
Rails 5 ActionController :: InvalidAuthenticityToken error
Мои Application Controller
является
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception, prepend: true
before_action :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:name])
devise_parameter_sanitizer.permit(:account_update, keys: [:name])
end
end
И мой другой BugController
является
class BugsController < ApplicationController
protect_from_forgery prepend: true, with: :exception
before_action :authenticate_user!
before_action :set_bug, only: [:show, :edit, :update]
def update
respond_to do |format|
if @bug.update(bug_params)
format.html { redirect_to @bug, notice: 'Bug was successfully updated.' }
format.json { render :show, status: :ok, location: @bug }
else
format.html { render :edit }
format.json { render json: @bug.errors, status: :unprocessable_entity }
end
end
end
private
def bug_params
params.require(:bug).permit(:product, :component, :title, :description, :status_id, :created_by_id, :assigned_to_id)
end
end
Я попытался поместить 'skip_before_filter: verify_authenticity_token' в контроллер ошибок, но все равно не работает. – HSD
показать мне, куда вы положили – Boltz0r
В 'Bugs controller'' protect_from_forgery preend: true, with:: exception before_action: authenticate_user! before_action: set_bug, только: [: шоу, редактировать,: обновление] ' – HSD