# Best way to edit associated models?

**URL:** <https://www.ruby-forum.com/t/best-way-to-edit-associated-models/156071>\
**Category:** Rails\
**Created:** [December 20, 2008, 12:37am UTC](https://www.ruby-forum.com/t/best-way-to-edit-associated-models/156071 "2008-12-20T00:37:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gracei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f6c823/32.png) [@gracei](https://www.ruby-forum.com/u/gracei)\
**Post date:** [December 20, 2008, 12:37am UTC](https://www.ruby-forum.com/t/best-way-to-edit-associated-models/156071/1 "2008-12-20T00:37:46Z")

</div>

What is a good way to edit associated models?

I am continuing a work project started by another. The schema doesn’t  
seem unreasonable. But it is pre-existing and I don’t yet have a  
reason to change it.

For example:

Location belongs\_to Company  
Workshop belongs\_to Company  
Workshop belongs\_to Location  
Workshop belongs\_to Questionnaire

Company has\_one Locations  
Company has\_many Workshops  
Location has\_many Workshops  
Questionnaire has\_many Workshops

I want to edit a Workshop training class. This has a company attached  
to it and through it has a location and a questionnaire attached to  
it. If I want to edit one of the associated models, such as to change  
the company name, is it reasonable to want to edit it in place with  
the rest of the workshop model? Generally here the relationship is  
one to one most of the time. Or is it better to force the data model  
on the editor and require them to edit each model on its own page? Is  
the data schema always forced upon the interface?

If this is strictly a one to one relationship does that change things?  
I want to edit a Company. This has a Location attached to it. If I  
want to edit the location must I force the user to edit the location  
on a dedicated page interface and then back to the Company edit page?

You can see the issue I am working though. General thoughts or  
recommendations here? Any good examples that you can point to?

Thanks  
Bob
