Giter VIP home page Giter VIP logo

Comments (5)

nhocki avatar nhocki commented on June 27, 2024

Ok, I "found" the problem but I have no idea how to solve it:

I have a select list inside my nested model. So the form has "f.select ..." but when I edit my object, it won't get selected in the one that it was stored. So I just added a
for c in competences
fields_for :competences, c do |builder|
render partial
end
end

And there is where the missing block error appears.

Any help?
Thanks

from nested_form.

nhocki avatar nhocki commented on June 27, 2024

Just had to use the f.object method to get what I wanted...

from nested_form.

findchris avatar findchris commented on June 27, 2024

Can you elaborate on your solution? I'm having the same problem.
Thanks.

from nested_form.

nhocki avatar nhocki commented on June 27, 2024

Ok, what I have is this:
#_form.html.erb
<% f.fields_for :webToolUrls do |builder| %>
<%= render 'webToolUrl_fields', :f => builder %>
<% end %>

  #_webToolUrl_fields.html.erb
  <% field_set_tag "Herramienta  Web 2.0", :class => "formFieldSet" do %> <br/>
     # Some other fields here ...
     <%= f.select :webTool_id, options_from_collection_for_select(WebTool.all, :id, :name, f.object.webTool_id) %> <br />  # notice the f.object.webTool_id
  <% end %>

I hope that helps

from nested_form.

findchris avatar findchris commented on June 27, 2024

That helps.
Thanks!

from nested_form.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.