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: :null_session
rescue_from ActiveRecord::RecordNotFound, :with => record_not_found #spazzing out
def record_not_found
flash[:error] = 'Could not find specified role'
redirect_to record_not_found_path
true
end
end
這是怎麼回事?當我嘗試和運行規範,我得到:未定義的方法 - record_not_found
in `<class:ApplicationController>': undefined local variable or method `record_not_found' for ApplicationController:Class (NameError)
我這麼想吳
你真的沒有描述什麼是錯的,而你的代碼顯示的解決方案認罪考慮更新以解釋爲什麼這會起作用。 – TheWebs
@TheWebs現在希望這樣做。 – devanand