Tom Mac wrote: > Hi Jon Cox > > Thanks for your reply. My idea is to create a saas based application > which has the initial signup procedure in basecamp like > > https://signup.37signals.com/basecamp/Basic/signup/new?source=signin-screen&__utma=1.193660493.1263811484.1263811484.1264389803.2&__utmb=1.10.10.1264389803&__utmc=1&__utmx=-&__utmz=1.1263811487.1.2.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=basecamp&__utmv=-&__utmk=101930241 > > > So as a first step I tried to design tables organizations and employees > as above and putting organization_owner_id in in organization table > .Please correct me if I am wrong > > Thanks > Tom
For something like Basecamp you'll end up with users having different types of role. Things like administrators, project managers, project leads, project members etc. I presume that a user could have more than one role as well? This lends itself to a structure to link your users to roles (or say employees to orangisation_roles) perhaps along the lines of: class Employee < ActiveRecord::Base has_many :employee_roles has_many :roles, :through => :employee_roles end class Role < ActiveRecord::Base has_many :employee_roles has_many :employees, :through => :employee_roles end class EmployeeRole < ActiveRecord::Base belongs_to :role belongs_to :employee end One of the roles could be the organisation owner as per your initial requirement. Again - i'd recommend reading the guide on assosiations (http://guides.rubyonrails.org/association_basics.html). more importantly though is to have a clear design to build against. I've recently been looking into Behaviour Driven Design (BDD) and it's already changing the way i'm approaching my work. Work through the behaviours you need your app to deliver before you work on a solution :) -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

