繁体   English   中英

Ruby on Rails-什么-路由错误:未初始化的常量ActionController :: Responder-平均值,我该如何解决?

[英]Ruby on Rails - What does - Routing Error: uninitialized constant ActionController::Responder - mean and how do I fix it?

我的Ruby on Rails网站上出现以下错误:

Routing Error: uninitialized constant ActionController::Responder

lib/application_responder.rb:1:in `<top (required)>'
app/controllers/application_controller.rb:1:in `<top (required)>'
app/controllers/jobs_controller.rb:1:in `<top (required)>'

在错误下方,其显示了从上到下优先级匹配的路由表。

它出现在所有页面上,我不确定是什么问题,如何解决? *我是Rails的新手。

任何帮助将不胜感激!

更新:不确定是否与我的jobs_controller.rb文件有关,其代码为:

class JobsController < ApplicationController

  def index
     @jobs = Job.page(params[:page]).per(20).order(created_at: :desc)
  end

  def new
      @job = Job.new
  end

  def show
      @job = Job.find(params[:id])
  end

  def create
     @job = Job.new(params.require(:job).permit(:human_sum, :position, :company, :salary, :companywebsite, :contract, :city, :expirydate, :jobtype, :description, :apply, :contactname, :contactemail, :contactphone, ))
      if @job.save
        redirect_to root_path
      else
        render "new"
      end
   end
end

lib / application_responder.rb-

class ApplicationResponder < ActionController::Responder
  include Responders::FlashResponder
  include Responders::HttpCacheResponder

  # Redirects resources to the collection path (index action) instead
  # of the resource path (show action) for POST/PUT/DELETE requests.
  # include Responders::CollectionResponder
end

做了一些其他文章的挖掘,发现如果我跑了...

sudo gem install responders 

它消除了错误,并且我的网站恢复了原来的状态。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM