Home>

Error resolution

Missing template contacts/index, application/index with {: locale =>[: en], : formats =>[: html], : variants =>[], : handlers =>[: raw,: erb,: html,: builder,: ruby,: jbuilder]}. Searched in: * "C:/Users/hiroa/Desktop/conduct/app/views" * "C:/Ruby26-x64/lib/ruby ​​/ gems/2.6.0/gems/devise-4.7.3/app/views "*" C: /Ruby26-x64/lib/ruby/gems/2.6.0/gems/actiontext-6.0 .3.4/app/views "*" C: /Ruby26-x64/lib/ruby/gems/2.6.0/gems/actionmailbox-6.0.3.4/app/views "

Error message
Display input screen

@contact = Contact.new
render: action =>'index'here
end

def confirm

Corresponding source code
Source code
class ContactsController 'index'
  end
  def confirm
     #Check input value
     @contact = Contact.new (contact_params)
     if @ contact.valid?
       # OK. Display confirmation screen
       render: action =>'confirm'
     else else
       # NG. Redisplay the input screen
       render: action =>'index'
     end
  end
  def complete
    # send e-mail
    @contact = Contact.new (contact_params)
    if params [: back]
      render: action =>'index'
    else else
      ContactMailer.send_mail (@contact) .deliver
      # Display the completion screen
      render: action =>'complete'end
  end
  private
  #Strong Parameter
def contact_params
  params.require (: contact) .permit (: name ,: company_name ,: phone_number ,: email ,: subject ,: message)
end
end
  Contact Contact)          <p>          * Handling of personal information<br />          The customer's personal information entered will not be used for any purpose other than the purpose of answering this inquiry.
      </p>                <% = form_for @contact,: url =>contacts_confirm_path do | f |%>          <% if @ contact.errors.any?%>                                  <strong>There is an error in the input content</strong>                <ul>                  <% @ contact.errors.each do | attr, msg |%>                    <li><% = msg%></li>                  <% end%>                </ul>                              <% end%>                                <label>Name<br /><small>(Your name)</small></label>                                        <% = f.text_field: name, class: "form-control"%>                                                                    <label>Company name<br /><small>(Company name)</small></label>                                        <% = f.text_field: company_name, class: "form-control", placeholder: "Option"%>                                                                    <label>Phone number<br /><small>(Phone number)</small></label>                <% = f.text_field: phone_number, class: "form-control"%>                                                                    <label>Email address<br /><small>(Email)</small></label>                                       <% = f.text_field: email, class: "form-control"%>                                                                    <label>Subject<br /><small>(Subject)</small></label>                                      <% = f.text_field: subject, class: "form-control"%>                                                                    <label>Inquiry content<br /><small>(Content)</small></label>                                      <% = f.text_area: message, class: "form-control", size: "30x10"%>                                                                                          <% = f.submit'submit', class:'btn btn-outline-dark btn-block'%>                                            </form>        <% end%>code
What I tried

I suddenly came out of the way I went out.
Even if I delete the render, I get a routing error.
Rails.application.routes.draw do

get'contacts/index'
post'contacts/confirm'
post'contacts/complete'
Is it different?

Supplementary information (FW/tool version, etc.)

] (03c482028b1bfade0ee0a836e128c6d1.png)
Please provide more detailed information here.

  • Answer # 1

    Move each contacts directory under views

    It will be solved for the time being, but if you do not keep it from the basic idea, you will likely be troubled by a similar problem without knowing "why it solves it".