前提・実現したいこと
宿泊予約サービスアプリを作成していて、予約内容の入力から予約完了画面に遷移させたい(予約確認画面は作成しません)のですが、syntaxerrorが出ました。うちま
問題となるエラーメッセージ
ActionView::SyntaxErrorInTemplate in ReservationsController#show Extracted source (around line #19): 17 <div class="d-flex"> 18 <%= f.label :start_date, '開始日', class: 'col-md-3' %> 19 <%= reservation.start_date, class: 'col-md-9' %> 20 </div> 21 </div> 22 <div class="row"> Rails.root: /Users/hayashikeiichirou/Desktop/rails2nd/roomshare Application Trace | Framework Trace | Full Trace app/views/reservations/show.html.erb:19: syntax error, unexpected tLABEL, expecting '=' app/views/reservations/show.html.erb:25: syntax error, unexpected tLABEL, expecting '=' app/views/reservations/show.html.erb:31: syntax error, unexpected ',', expecting ')' app/views/reservations/show.html.erb:19: syntax error, unexpected tLABEL, expecting '=' app/views/reservations/show.html.erb:25: syntax error, unexpected tLABEL, expecting '=' app/views/reservations/show.html.erb:31: syntax error, unexpected ',', expecting ')' app/views/reservations/show.html.erb:19: syntax error, unexpected tLABEL, expecting '=' app/views/reservations/show.html.erb:25: syntax error, unexpected tLABEL, expecting '=' app/views/reservations/show.html.erb:31: syntax error, unexpected ',', expecting ')' app/views/reservations/show.html.erb:19: syntax error, unexpected tLABEL, expecting '=' app/views/reservations/show.html.erb:25: syntax error, unexpected tLABEL, expecting '=' app/views/reservations/show.html.erb:31: syntax error, unexpected ',', expecting ')' app/views/reservations/show.html.erb:19: syntax error, unexpected tLABEL, expecting '=' app/views/reservations/show.html.erb:25: syntax error, unexpected tLABEL, expecting '=' app/views/reservations/show.html.erb:31: syntax error, unexpected ',', expecting ')' app/views/reservations/show.html.erb:19: syntax error, unexpected tLABEL, expecting '=' app/views/reservations/show.html.erb:25: syntax error, unexpected tLABEL, expecting '=' app/views/reservations/show.html.erb:31: syntax error, unexpected ',', expecting ')'
該当のソースコード
<%= render 'users/host' %> <div class="container-fiuld user"> <div class="row"> <div class="d-flex"> <div class="col-md-12 user-view"> <div class="user-view-box"> <% form_with(model: @reservation) do |f| %> <% @reservations.each do |reservation| %> <div class="update-content"> <div class="row"> <div class="d-flex"> <%= f.label :room_name, '予約した部屋', class: 'col-md-3' %> <%= link_to reservation.room_name, user_room_path(@room.id), class: "col-md-9" %> </div> </div> <div class="row"> <div class="d-flex"> <%= f.label :start_date, '開始日', class: 'col-md-3' %> <%= reservation.start_date, class: 'col-md-9' %> </div> </div> <div class="row"> <div class="d-flex"> <%= f.label :end_date ,'終了日', class: 'col-md-3' %> <%= reservation.end_date, class: 'col-md-9' %> </div> </div> <div class="row"> <div class="d-flex"> <%= f.label :total_price ,'価格', class: 'col-md-3' %> <%= reservation.price * reservation.number_of_people, class: 'col-md-9' %> </div> </div> </div> <% end %> <% end %> </div> </div> </div> </div> </div> <div> <ul> <li><%= f.submit '登録完了する' %><li> <li><%= link_to "トップ画面に戻る", user_path(current_user.id) %></li> </ul> </div>
試したこと
下記のサイトを参考にしましたが解決できませんでした。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/05/16 07:36