vendredi 8 janvier 2016

error in rendering a form partial in rails

I am trying to render a page on a click event in Rails app.

In my page I am rendering the partial like <%= render "form" %>

My form partial is under contacts/_form.html.erb.

In my _form.html.erb I have form fields.

But I am not getting the form rendered.

This is the error I am getting

Missing partial pages/form with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/home/ubuntu/workspace/app/views"

below is my _form.html.erb

  <%= form_for(@contact) do |f| %>
    <% if @contact.errors.any? %>
    <div id="error_explanation">
    <h2><%= pluralize(@contact.errors.count, "error") %> prohibited this contact from being saved:</h2>

    <ul>
      <% @contact.errors.full_messages.each do |msg| %>
     <li><%= msg %></li>
      <% end %>
    </ul>
    </div>
    <% end %>

  <div class="col-md-4">
    <div class="form-group">
    <div class="field">
    <%= f.label :name %><br />
    <%= f.text_field :name, :class=>"form-control", :placeholder=>"Enter Your Name" %>
    </div>
    <div class="field">
      <%= f.label :email %><br />
      <%= f.text_field :email, :class=>"form-control", :placeholder=>"Enter Your Email"%>
    </div>
    <div class="field">
     <%= f.label :phone %><br />
     <%= f.text_field :phone, :class=>"form-control", :placeholder=>"Enter Your Phone Number"%>
     </div>
     </div> 
     </div>

   <div class = "col-md-8">
  <div class="form-group">
  <div class="field">
   <%= f.label :description %><br />
   <%= f.text_area :description,  :class=>"form-control", :size=>"20x5", :placeholder=>"Enter Your Message"%>
   </div>
  </div>
 </div>

  <div class="actions">
   <%= f.submit "Submit", :class=> "button1"%>
  </div>  
 <% end %>

What am I Doing wrong?

Aucun commentaire:

Enregistrer un commentaire