我的应用程序控制器中有以下代码:
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found
private
def record_not_found
render :text => "404 Not Found", :status => 404
end
end
当我运行它(实际上我运行rake db:migrate
)时,我得到了错误uninitialized constant ActiveRecord::RecordNotFound
。这似乎太简单了——帮助!