# Question about form with one-to-one models

**URL:** <https://www.ruby-forum.com/t/question-about-form-with-one-to-one-models/111470>\
**Category:** Rails\
**Created:** [August 7, 2007, 6:21pm UTC](https://www.ruby-forum.com/t/question-about-form-with-one-to-one-models/111470 "2007-08-07T18:21:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![huang\_zhimin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/54ee81/32.png) [@huang\_zhimin](https://www.ruby-forum.com/u/huang_zhimin)\
**Post date:** [August 7, 2007, 6:21pm UTC](https://www.ruby-forum.com/t/question-about-form-with-one-to-one-models/111470/1 "2007-08-07T18:21:28Z")

</div>

For example, I have two models Person and Address, that one person has  
one  
address.

class Person \< ActiveRecord::Base  
has\_one :address  
end

class Address \< ActiveRecord::Base  
belongs\_to :person  
end

Now, I want to write a form to create a person including an address

Name  
\<%= text\_field 'person', 'name', :size =\> 10 %\>

......

Country  
\<%= text\_field 'person', 'address.country' %\>

 # i think it will map to person.address.country, but it doesn't work, how can i do it? ......

–

> **[CodeLineStatistics](https://sourceforge.net/projects/mycodeline/)**
>
> Download CodeLineStatistics for free. The code line statistics takes files and directories from GUI, counts the total files, total sizes of files, total lines, lines of codes, lines of comments and lines of blanks in the files, displays the results...

[http://rubyforge.org/projects/ropenwiki/](http://rubyforge.org/projects/ropenwiki/)
