# Nested forms

**URL:** <https://www.ruby-forum.com/t/nested-forms/168370>\
**Category:** Rails\
**Created:** [May 20, 2009, 3:23am UTC](https://www.ruby-forum.com/t/nested-forms/168370 "2009-05-20T03:23:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![melvinram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a698b9/32.png) [@melvinram](https://www.ruby-forum.com/u/melvinram)\
**Post date:** [May 20, 2009, 3:23am UTC](https://www.ruby-forum.com/t/nested-forms/168370/1 "2009-05-20T03:23:44Z")

</div>

[http://pastie.org/private/ju5htjk8kqjdqik94br0nw](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](http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes)  
… any ideas on what I’m doing wrong?

---

<div class="post-metadata">

**Author:** ![melvinram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a698b9/32.png) [@melvinram](https://www.ruby-forum.com/u/melvinram)\
**Post date:** [May 20, 2009, 8:33am UTC](https://www.ruby-forum.com/t/nested-forms/168370/2 "2009-05-20T08:33:17Z")

</div>

Melvin R. wrote:

> [http://pastie.org/private/ju5htjk8kqjdqik94br0nw](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](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.

---

<div class="post-metadata">

**Author:** ![melvinram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a698b9/32.png) [@melvinram](https://www.ruby-forum.com/u/melvinram)\
**Post date:** [May 20, 2009, 8:45am UTC](https://www.ruby-forum.com/t/nested-forms/168370/3 "2009-05-20T08:45:33Z")

</div>

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-](http://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](mailto:removed_email_address@domain.invalid)
