Forum: Ruby on Rails Nested forms

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Melvin R. (Guest)
on 2009-05-20 05:23
(Received via mailing list)
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...
... any ideas on what I'm doing wrong?
Jason P. (Guest)
on 2009-05-20 10:33
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...
> ... 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.
Melvin R. (Guest)
on 2009-05-20 10:45
(Received via mailing list)
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. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.