###前提・実現したいこと
form_forでデータを記録したいのですが、local serverを起動している時に以下のエラーメッセージが発生しました。
###Template is missing
Missing template votes/update, application/update with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in: * "/vagrant/election-app/app/views"
###試したこと
課題に対してアプローチしたことを記載してください
###補足情報(言語/FW/ツール等のバージョンなど)
ruby on rails
*routes.rb
Rails.application.routes.draw do root "votes#index" resource :votes end
*controller/concerns/votes_controller.rb
class VotesController < ApplicationController def index @vote = Vote.new end def create Vote.create(sex: params[:sex],age: params[:age]) redirecte_to :root end def update end private def vote_params params.require(:vote).permit(:sex,:age) end end
*views/votes/index.heml.erb
<%= form_for @vote do |f| %> <li> <%= f.label '男女をお選び下さい。'%></br> <%= f.radio_button 'sex','0'%><%= f.label '男'%> <%= f.radio_button 'sex','1'%><%= f.label '女'%></br> </li></br> <li> <%= f.label '年齢層をお選び下さい。'%></br> <%= f.radio_button 'age','0'%><%= f.label '18~19歳'%> <%= f.radio_button 'age','1'%><%= f.label '20~24歳'%> <%= f.radio_button 'age','2'%><%= f.label '25~29歳'%> <%= f.radio_button 'age','3'%><%= f.label '30~34歳'%> <%= f.radio_button 'age','4'%><%= f.label '35~39歳'%> <%= f.radio_button 'age','5'%><%= f.label '40~44歳'%> <%= f.radio_button 'age','6'%><%= f.label '45~49歳'%> <%= f.radio_button 'age','7'%><%= f.label '50~54歳'%> <%= f.radio_button 'age','8'%><%= f.label '55~59歳'%> <%= f.radio_button 'age','9'%><%= f.label '60~64歳'%> <%= f.radio_button 'age','10'%><%= f.label '65~69歳'%> <%= f.radio_button 'age','11'%><%= f.label '70~74歳'%> <%= f.radio_button 'age','12'%><%= f.label '75~79歳'%> <%= f.radio_button 'age','13'%><%= f.label '80~84歳'%> <%= f.radio_button 'age','14'%><%= f.label '85~89歳'%> <%= f.radio_button 'age','15'%><%= f.label '90歳~'%></br> </li></br> <%= f.submit '完了' %> <% end %>