index.html.erbを表示したいのですが表示されません。解決方法をご教授お願いします。rails sをしてhttp://localhost:3000/inquiries で表示したいです。
routes.rb get 'inquiries', to: 'inquiries#index' post 'inquiries/confirm', to: 'inquiries#confirm' post 'inquiries/complete', to: 'inquiries#complete'
inquiries_controller.rb class InquiriesController < ApplicationController def index @inquiry = Inquiry.new render action: 'index' end def confirm @inquiry = Inquiry.new(inquiry_params) if @inquiry.valid? render action: 'confirm' else render action: 'index' end end def complete @inquiry = Inquiry.new(inquiry_params) InquiryMailer.inquiry_email(@inquiry).deliver_now render action: 'complete' end private def inquiry_params params.require(:inquiry).permit(:name, :email, :message) end end
index.html.erb <% provide(:title, "お問い合わせ") %> <h1>お問い合わせ</h1> <%= form_for @inquiry, :url => inquiries_confirm_path do |f| %> <%= render 'shared/error_messages', object: f.object %> <%= f.label :name, "名前" %> <%= f.text_field :name %> <%= f.label :email, "メールアドレス" %> <%= f.email_field :email %> <%= f.label :message, "お問い合わせ内容" %> <%= f.text_area :message %> <%= f.submit "確認" %> <% end %>
コードはコードブロック(```)でファイルごとに囲んでください。また、どういう状況なのか(どんなアクションをして表示されないのかなど)分かるように記載し、エラーが出ているならエラーを記載してください。