Hi, you might want to look into creating a polymorphic association because
Customer and Supplier are different types of a User. Also, a Shop is a
place of business and a Quote is an estimated price for a service. Please
check the following link:
Optimizing aggregate counts of has_many_polymorphs in Rails: Part
I<http://erolfornoles.wordpress.com/2008/08/10/optimizing-aggregate-counts-of-has_many_polymorphs-in-rails-part-i/>
Good luck,
-Conrad
On Fri, Aug 29, 2008 at 5:20 AM, n0d dy
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote:
>
> Not wishing to start out on the wrong foot in the world of RoR, I would
> be grateful if someone could advise me if the following setup would be
> considered best practice or could it be improved upon.
>
> I have five models:
>
> User
> Customer
> Shop
> Supplier
> Quote
>
> A user can sign up as a customer, shop or supplier. I''ve gone for
a
> ''skinny'' user table and have created belongs_to/has_many
associations to
> the different types of users (via user_id in their respective tables).
>
> A new quote will be created by a customer, the quote will then need to
> be accessed by the shop, who will update it, and then the supplier who
> will also update it. Do I now just need a quote table with customer_id,
> shop_id, supplier_id and their respective belongs_to/has_many
> associations, or is there a more preferred solution?
>
> Thanks
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---