Reputation: 1851
I am facing a 500 internal error in my navigator's console.
in the server console :
Completed 500 Internal Server Error in 359ms
ActionView::MissingTemplate (Missing template questions/vote_for, application/vote_for with {:locale=>[:en], :formats=>[:js, :html], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "/home/seif/Documents/ROR/Voting_trial/StackUnderflow/app/views" ):
app/controllers/questions_controller.rb:90:in `vote_for'Rendered /home/seif/.rvm/gems/ruby-2.0.0-p353/gems/actionpack-3.2.13/lib/action_dispatch/middleware/templates/rescues/missing_template.erb within rescues/layout (0.5ms)
what is the problem?
this is the vote_for action:
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
and this is the view call :
<%=link_to raw( vote_for, vote_for_question_path(@question), :remote => true,:class =>"btn btn-default btn-lg" %>
Upvotes: 1
Views: 689
Reputation: 195
To be more clear... The error is because the templates cannot be found.
First if you do want to support js and html responses then you need a template for both.
So you need ONE of the following:
/app/views/questions/vote_for.html.erb
/app/views/application/vote_for.html.erb (bad practice)
AND one of the following
/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)
Upvotes: 0