i am trying to use cocoon for nested ajax form coupled with formtastic
my rails version
Rails 3.2.3
i have put gem "cocoon" im my gemfile and did a bundle install
then in my elements/_form.html.erb:
<%= semantic_form_for @element do |f| %>
<%= f.inputs do %>
<%= f.input :projects, :label_method => :projectname%>
<%= f.semantic_fields_for :experiments do |exp| %>
<% render 'experiment_fields', :f => exp %>
<%= link_to_add_association "Add experiment", f, :experiments%>
<%end%>
<% end %>
<%= f.actions :submit, :cancel %>
<% end %>
with elements/_experiment_fields.html.erb :
<div class='nested-fields'>
<%= f.input :exptype %>
<%= link_to_remove_association "remove experiment", f %>
</div>
this generate no error but do not display the nested link or form
i then added to assets/application.js:
//= require cocoon
and to layout/application.html.erb
<%= javascript_include_tag :cocoon %>
this generate the error :
couldn't find file 'cocoon'
did i miss something in cocoon installation ? could anyone help?
I just got this error after adding //= require cocoon to the asset pipeline, before restarting my rails server. Obviously you have probably restarted your rails server at this point, but for the sake of anyone else with this error, try restarting rails.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With