开发者

Rails Undefined Constant: ActiveRecord::RecordNotFound

开发者 https://www.devze.com 2023-03-31 23:01 出处:网络
I have the following code in my Application Controller: class ApplicationController < ActionController::Base

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

精彩评论

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