开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜