Hey, awesome content! Those nested forms can be a real head scratcher for new devs, I was struggling with it very much However, I think that when you are whitelisting params in #todo_list_params it is better to always whitelist them explicitly, not using this obscure #map trick. Newbie developer can spot it and could probably want to use it with models with admin fields, etc, therefore exposing entire resource for manipulations.
@jamespage47844 жыл бұрын
How would you adapt this to work with another level of nesting?
@muhammadmehdi57894 жыл бұрын
ActionView::MissingTemplate in Crms#new it gives me error on render line, can you please help to get rid off this error? Extracted source (around line #6): id = new_object.object_id fields = form.fields_for(association, new_object, child_index: id) do |builder| render(:association.to_s.singularize, form: builder) end link_to(name, '#', class: "add_fields " + args[:class], data: {id: id, fields: fields.gsub(" ", "")}) end
@taab847 жыл бұрын
how to use json data for child instead of a separate model? for exemple for a client who have one or multiple phones
@DriftingRuby7 жыл бұрын
+taab84 I would use serialized attributes and declare the attribute as a Jain. Postgres and MySQL 5.7 support the json datatype.
@aram25487 жыл бұрын
Hello, Im not using simple_form, but I tried your code but nothing happens here when I click on add. Do you know what could it be?
@aram25487 жыл бұрын
Thanks for the reply. My project is here github.com/aramsm/miniapp-autoseg When I click on add nothing happens
@DriftingRuby7 жыл бұрын
Your JS is appending the new form elements to $('.fields') but you do not have the class "fields" in your app so it's not getting added anywhere.
@aram25487 жыл бұрын
That worked, but now its creating duplicated fields, but that must be easy to track and fix. Thanks for the awesome tutorial.
@archanam.p60186 жыл бұрын
hello how to use the nested form datepicker? Thanks in advance
@frmoudoute5 жыл бұрын
Archana, could you find a solution ?
@R2r_13377 жыл бұрын
and your #link_to_add_field helper is not working if you don't pass any css class, args[:class] is nil in this case and it throws an error saying that you can't convert nil intro string insted of link_to(name, '#', class: 'add_fields ' + args[:class] you should use link_to(name, '#', class: 'add_fields ' + args.fetch(:class, "") therefore making class optional
@muhammadmehdi57894 жыл бұрын
ActionView::MissingTemplate in Crms#new it gives me error on render line, can you please help to get rid off this error? Extracted source (around line #6): id = new_object.object_id fields = form.fields_for(association, new_object, child_index: id) do |builder| render(:association.to_s.singularize, form: builder) end link_to(name, '#', class: "add_fields " + args[:class], data: {id: id, fields: fields.gsub(" ", "")}) end
@trailblazer_nomad6 жыл бұрын
Nice hax rendering the form to 'data' attribute ;)
@navroopsingh16 жыл бұрын
is any gem installed for running this?
@jaimeandres10416 жыл бұрын
yes check this, github.com/nathanvda/cocoon
@tatawhillman37832 жыл бұрын
So many thing cramped into one video. A better tutorial of splitting this into several videos and really explaining the concepts will go a long way to help beginner rails users
@slim_mike6 жыл бұрын
this seems like a remake of this railscast episode kzbin.info/www/bejne/l563Y2qJm7Obga8