I try to update a nested model (version) and get this error. any tips
would be great!
my models: location has_many :versions
# view
<% form_for location do |location_form| %>
<ul class="location">
<li><%= location_form.label location.section %></li>
<li><%= location_form.label location.sub_section %></li>
<li><%= location_form.label location.place_holder %></li>
</ul>
<div class="content-area">
<% location.versions.each do |version| %>
<div class="content" >
<% location_form.fields_for version do |version_form| %>
<%= version_form.label version.environment %>
<%= version_form.text_area :content %>
<% end %>
</div>
<% end %>
<%= submit_tag %>
</div>
<% end %>
#controller
def update
@location = Location.find(params[:id])
@location.update_attributes(params[:location]) #error: unknown
attribute: version
redirect_to( locations_path )
end
# the params
{"location"=>{"version"=>{"content"=>"hello human. glass robot want
you to join Glass"}}, "commit"=>"Save changes",
"authenticity_token"=>"l59NxAeIeHnvaVt+1xQV2e9NpDIS8nPpQ4RY+hU0k7w=",
"id"=>"2"}
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.