On Thursday, 7 April 2016 01:06:54 UTC-4, Jonatas Baldin wrote:
>
> Hi, I'm having trouble to create an application with dynamic fields. Could 
> you guys help me out?
> I'm not gonna write everything again, here's the stack overflow post and a 
> gist with what I got working and what's not.
>
> The links have the same content:
>
> http://stackoverflow.com/questions/36449947/application-with-dynamically-custom-fields
> https://gist.github.com/jonatasbaldin/906673980f847b30ec2cf6951dcb136e/edit
>
>
You'll want to read up on `fields_for`, which will help you build the 
required HTML inputs. I'd also recommend the Railscast on this 
topic: http://railscasts.com/episodes/196-nested-model-form-revised

Some other general notes on your Gist:

* has_many associations should be plural. Things will usually work with 
them named otherwise, but you may encounter odd behavior.

* the data model doesn't seem quite right - custom_field_infos should have 
a contact_id column and a custom_field_id column (to indicate which contact 
& field this record has data for). It shouldn't need a user_id column 
unless there's something else going on that's not mentioned in the Gist.

--Matt Jones

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/be03e15d-56a5-417a-91cc-6c80bdbf3f66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to