在我的导航控制台中,我面临着500个内部错误。
在服务器控制台中:
在359 in内完成500台内部服务器错误
ActionView::MissingTemplate (缺少模板问题/表决_for,应用程序/表决_for与{:locale=>:en,:formats=>:js,::formats=>:js,:html,:handlers=>:erb,:builder,:咖啡})。搜索:* "/home/seif/Documents/ROR/Voting_trial/StackUnderflow/app/views“): app/控制器/问题控制器.in:90:in `vote_for‘ 在救援/布局中呈现/home/seif/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-3.2.13/lib/action_dispatch/middleware/templates/rescues/missing_template.erb (0.5ms)
有什么问题吗?
这是vote_for操作:
def vote_for
logger.info "***vote for***!!!"
logger.info params[:id]
@quest_vote_for = Question.find(params[:id])
current_user.vote_exclusively_for(@quest_vote_for)
respond_to do |format|
format.js
format.html
end
end这就是视图调用:
<%=link_to raw( vote_for, vote_for_question_path(@question), :remote => true,:class =>"btn btn-default btn-lg" %>发布于 2014-02-13 23:17:20
更清楚一点..。错误是因为找不到模板。
首先,如果您确实希望支持js和html响应,那么您需要为两者都提供一个模板。
因此,您需要下列之一:
/app/views/questions/vote_for.html.erb
/app/views/application/vote_for.html.erb (bad practice)和下列之一
/app/views/questions/vote_for.js.erb
/app/views/questions/vote_for.js.coffee
/app/views/application/vote_for.js.erb (bad practice)
/app/views/application/vote_for.js.coffee (bad practice)https://stackoverflow.com/questions/21767193
复制相似问题