Rails Undefined Constant: ActiveRecord::RecordNotFound
I have the following code in my Application Controller:
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_fr开发者_C百科om ActiveRecord::RecordNotFound, :with => :record_not_found
private
def record_not_found
render :text => "404 Not Found", :status => 404
end
end
When I run it (actually I run rake db:migrate
) I get the error uninitialized constant ActiveRecord::RecordNotFound
. This seems too simple -- HELP!
It needed require 'active_record/errors'
, which I didn't see on any of the examples I found when I googled.
精彩评论