Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing partial #516

Closed
erniux opened this issue Jul 20, 2018 · 2 comments
Closed

Missing partial #516

erniux opened this issue Jul 20, 2018 · 2 comments

Comments

@erniux
Copy link

erniux commented Jul 20, 2018

Hello, I have this issue:
When I render my file, without link_to_add_association, my application render perfectly my partial:

    <%= form.fields_for :partidas_cotizacions do |pc_form| %>
       <%= render 'partidascotizacions_fields', form: pc_form %>
    <% end %>
   
    <div>      
    </div>

But as long I put the Link_to_add_association:

 
    <%= form.fields_for :partidas_cotizacions do |pc_form| %>
       <%= render "partidascotizacions_fields", form: pc_form %>
    <% end %>
    <div>
       <%= link_to_add_association 'Agregar', form, :partidas_cotizacions %>
    </div>
</div>

it throw me the error:

ActionView::Template::Error (Missing partial cotizacions/_partidas_cotizacion_fields, application/_partidas_cotizacion_fields with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in:

  • "/Users/ernatercerorodriguez/Cotiza/app/views"
  • "/Users/ernatercerorodriguez/.rvm/gems/ruby-2.4.1/gems/kaminari-core-1.1.1/app/views"
  • "/Users/ernatercerorodriguez/.rvm/gems/ruby-2.4.1/gems/devise-4.4.3/app/views"
    ):
    136: <%= render 'partidascotizacions_fields', form: pc_form %>
    137: <% end %>
    138:

    139: <%= link_to_add_association 'Agregar', form, :partidas_cotizacions %>
    140:

    141:

142:

and my fields partial: _partidascotizacions_fields.html.erb:

<div class="row nested-fields">
<li>
  <div class="col-2"><%= form.label :num_partida %></div>
  <div class="col-2"><%= form.text_field :num_partida %></div>
  <div class="col-2"><%= form.label :fecha_entrega %></div>
  <div class="col-2"><%= form.date_field :fecha_entrega %></div>
  <div class="col-2"><%= form.label :producto_id %></div>
  <div class="col-2"><%= form.text_field :producto_id %></div>
  <div class="col-2"><%= link_to_remove_association 'Eliminar', form %></div>
</li>
</div>

Deleting even works fine but cant find or understand what is wrong with my line:

<%= link_to_add_association 'Agregar', form, :partidas_cotizacions %>

@nathanvda
Copy link
Owner

So cocoon goes looking for a partial named cotizacions/_partidas_cotizacion_fields (as the error also mention), and your partial is called _partidascotizacions_fields.html.erb.

You have two options: rename the partial, or write

<%= link_to_add_association 'Agregar', form, :partidas_cotizacions, partial: 'partidascotizacions_fields'  %>

@nathanvda
Copy link
Owner

Closed due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants