Brett Hammond
2011-Oct-06 00:29 UTC
How to correctly setup this relationship and database schema for this problem
Cant seem to wrap my mind around this... Purpose: Company to upload Jobs into system and allow Vendors to bid on job items. Quick rundown: Company creates new job, part of that creation is uploading .xls of list of job items, in that .xls we have a column called ''type'', (each vendor chooses which ''type'' of job items there company accepts) after job saved and job items uploaded the page goes to an invitations page where even though a vendor has already pre chosen the types they accept we want to be able to manually say Vendor A is invited to view Type A, Type B, but not Type C and so on for each vendor. After each vendor is invited to view this specifac job and its job items types then they get emailed telling them of the new job and its items added, they login and bid on each job item that they are allowed by the job item type. So far... Jobs Model - title:string job_number:string description:text Jobitems Model - job_id:integer type_id:integer ...... all the other fields Vendor Model - name:string address:string all that stuff Types Model - code:string name:string ( code is the abbreviated version of the name so P for Plate) types_models - type_id:integer vendor_id:integer (has_and_belongs_to_many association for Types and Vendors Cant figure out: How to setup so that each jobitem has many vendor invitations by the jobitems ''type'' and how to allow only invited vendors to see each jobitems by the type -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.