Forum: Ruby on Rails Best way to edit associated models?

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.
Bob P. (Guest)
on 2008-12-20 01:37
(Received via mailing list)
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
This topic is locked and can not be replied to.