Ruby on Rails - Create Entity with Relationship

Posted by SooDesuNe on Stack Overflow See other posts from Stack Overflow or by SooDesuNe
Published on 2010-06-11T04:10:00Z Indexed on 2010/06/11 4:12 UTC
Read the original article Hit count: 268

Filed under:
|

I'm new to rails, so be nice.

I'm building a "rolodex" type application, and this question is about the best way to handle creating an entity along with several relationship entities at the same time.

For (a contrived) example: My application will have a Person model, which has_one Contact_Info model. On the create.html.erb page for Person it makes sense for the user of my appliction to create the person, and the contact_info at the same time.

It doesn't seem right to include details for creating a contact directly in the create view/controller for person. What's the rails way to handle this?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about has-one