Closed Startouf closed 9 years ago
Actually, [new_phases]
is substituted if one phase
has been saved in the DB, and the view loads it. But then, whatever the number of phase
for the current Project
, [new_phases]
is always substituted by [0]
, which is exactly the same as described in issue https://github.com/ryanb/nested_form/issues/258
Ok so my problem is that I didn't realise that the class "fields" was at the core of the gem.
And in my case, I had some stupid CSS style .field {display: table-caption}
coming from God knows where, that screwed up everything when I tried to use it.
Because my __xxxfields.html.erb partials included more than one <tr>
, I couldn't just tag the first one with this class, but rather I had to wrap them inside a <tbody class="fields">
.
But anyway, it should be mentionned on the doc that the class "fields" is very important, and how to use it well.
So I have two levels of nesting Project has_many :phases Phase has_many :affectation
Problem is that when I dynamically add a new phase, and inside I add a new affectation using
link_to_add '', :phases
andlink_to_add '', :affectations
, well my nested affectation cannot resolve the ID of the Phase anymore. Thus every element generated by the nested form will generate a name like:The problem being that
[new_phases]
isn't replaced by the proper generated IDI am using tables and nested tables, but I then I tagged the different tables with an ID:
_phase_fields.html.erb
So it shouldn't be a problem right ? So how come
[new_phases]
isn't substituted ? I'll try to look at the source code of the gem but I'm not sure I'm goog enough to track the bug. Or maybe I just forgot something else in my code ?