i want to explain what i want to do with the following example: I want to model students and employees. With EER i would use partitioning to do that and create a model persons, to carry the attributes both, students and emploees, have in common. How do i model that? Well my guess was the follwing:
class Person < ActiveRecord::Base has_many :students has_many :employees end class Employee < ActiveRecord::Base belongs_to :persons end class Student < ActiveRecord::Base belongs_to :persons end
Now i had to pass the attributes out of params[:xy] in view/students/new to a call of Person.new() …quite verbous, and since i remember i had problems to validate the fields that belong to Person.
Maybe i should do something like the following:
class Person < ActiveRecord::Base end class Employee < Person end class Student < Person end
Sad wise there are no examples for inheritance among models in the book.
Hope somehone has suggestions.