Nested forms

http://pastie.org/private/ju5htjk8kqjdqik94br0nw

Line 11 in this pastie is causing errors. errors are including in
pastie. I was basing this on the example on
http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes
… any ideas on what I’m doing wrong?

Melvin R. wrote:

http://pastie.org/private/ju5htjk8kqjdqik94br0nw

Line 11 in this pastie is causing errors. errors are including in
pastie. I was basing this on the example on
http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes
… any ideas on what I’m doing wrong?

Hi Melvin,

I’m not 100% sure on this, but it looks like your syntax is wrong from
the way that I know it. In the line:

= user_form.label :password, user_form.object.new_record? nil : “Change
password”

new_record? is a method that returns true or false, that’s why the
question mark at the end. My guess is that you are passing nil to the
method new_record?() rather than correctly doing the inline if/else.

to do it inline I would write it like this:

user_form.object.new_record? ? nil : “Change password”

Otherwise my next guess would be that some object isn’t initiated in the
controller somewhere.

Thanks for the reply. I did find that problem and got it fixed.

After that, I was stuck at a much bigger problem/bug (https://
rails.lighthouseapp.com/projects/8994/tickets/1943-nested-attributes-
validations-circular-dependency) but I decided to change my
requirements. Looks like there isn’t a real solution to this bug yet.

On May 19, 11:33 pm, Jason P. [email protected]