Skip to content

Nested attributes not working on 3.1.0rc4 #2190

koichirose opened this Issue Jul 22, 2011 · 3 comments

2 participants


Hello, I'm sorry if this is actually not an issue but I'm a Rails (and Ruby) newbie.

I tried to set up this simple code with Rails 3.1.0rc4 and Ruby 1.9.2 (managed with RVM).

This won't show the picture fields.
I can however do this in a rails console:

@s =
@s.pictures_attributes = [ { :name => 'picture_name' } ]

I tried the exact same code with Rails 3.0.9 (i.e. 'rails new test_app' and then copied over the models, controllers, views and sqlite db) and it works as expected.

Again, if I did something wrong I'm sorry, please delete this issue :)

<% f.fields_for :pictures do |picture_form| %>

should probably be

<%= f.fields_for :pictures do |picture_form| %>

You forgot the =
I think this worked in previous versions and was deprecated in 3.0 and removed in 3.1 or something like that, but I could be wrong. Nevertheless just add the = sign and it will Just Work ;]


Metallord, thanks, it is working.
How's one supposed to know these subtle changes, though?

Thanks again, closing this one

@koichirose koichirose closed this Jul 23, 2011

Read the changelogs? ;)
I think it was also mentioned in railscasts around episode 200 which came out around the premiere of Rails 3.0.beta. There were quite a few chenges around then so either you or the source where you were finding out about those changes could have missed it as it's very subtle.
Nevertheless check your logs, because if I remember correctly rails 3.0 throws up deprecation warnings when you use the old syntax at least in form_for calls. I don't know about fields_for for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.