Re: [Rails] Re: how to specify relationship between these models

2010-03-19 Thread Michael Pavling
On 19 March 2010 11:43, Tom Mac wrote: > why everything is stored in a single table That's called Single Table Inheritance (STI) > Can we store each items for say staff,director etc  to > there own tables? Or Am I wrong? You're not wrong; you can do it with different tables if you want. Data m

[Rails] Re: how to specify relationship between these models

2010-03-19 Thread Tom Mac
Hi Thanks for your reply. This I have already thought of. But one thing I can't understand is why everything is stored in a single table say users here? Can we store each items for say staff,director etc to there own tables? Or Am I wrong? Tom -- Posted via http://www.ruby-forum.com/. -

[Rails] Re: how to specify relationship between these models

2010-03-19 Thread Veera Sundaravel
Let say you are having staff, directors and managers as part of your system, and their details will be in users table so let say we can build inheritance based relationship like below: Class User < ActiveRecord::Base end Class Staff < User end Class Director < User end Class Manager < User