我的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
它删除了错误,我的网站又回到了原来的样子。