In Ruby on Rails this creates a scope around a specific model object like #form_for, but doesn’t create the form tags themselves. This makes #fields_for suitable for specifying additional model objects in the same form.
Questions tagged [fields-for]
259 questions
0
votes
1 answer
has_one with :class_name, and belongs_to relation not setting attributes correctly in rails 3.2.3
I'm trying to make a form to set values to two children objects through has_one (with :class_name option) and belongs_to relation. However, when I input and submit values through the form, both children objects have the same value even if I input…
![](../../users/profiles/1330926.webp)
Ryo
- 1,823
- 3
- 23
- 38
0
votes
1 answer
Nil object using generic fields_for
I am trying to pass parameters using a generic fields_for method. I have a form:
<%= form_for @Album do |album| %>
...
<%= fields_for :photo do |photo| %>
<%= photo.text_field :name %>
<%= photo.text_area :description %>
...
<% end %>
<% end…
![](../../users/profiles/523686.webp)
yoshyosh
- 13,484
- 13
- 36
- 46
-1
votes
1 answer
Fields_for without a do loop
Is there a way to do fields_for a has_many association without looping through all the associated items?
I have a very similar situation to that discussed here:
I have a Person model, with several related models (Address, Phone number,…
![](../../users/profiles/3464753.webp)
thenapking
- 135
- 12
-1
votes
2 answers
Unpermitted Parameters Error for Whitlisted Attributes
I'm working on a sort of web based game using rails. My goal is to set up a form that allows a user to create a fort on the user/show page via a user update form. I have been using nested attributes and associations to try to solve the problem but I…
![](../../users/profiles/3424890.webp)
obventio56
- 315
- 2
- 11