I'm struggling with the following problem: I have a class, call it 'School'. An instance of School can have all sorts of assets, such as 'Books', 'Tables', 'Chairs', 'Teachers'. Each of these asset types is modeled by it's own model and has a corresponding table in the db. So, there is a table for 'Chair, another for 'Teacher' and so on. In summary, in the abstract, each school has_many assets and each asset belongs_to a school.
I'd like to be able to do things like: school = School.find(3) school.assets << Chair.new(chair_params) school.assets << Teacher.new(teacher_params) school.assets.each{|a| puts a.name} I tried to solve it by defining an abstract class: class Asset << ActiveRecord::Base self.abstract_class = true end and inheriting from it: class Book << Assets belongs_to :school end and class School << ActiveRecord::Base has_many :assets end That gets me part way there but I fear is fundamentally flawed. Most of the time it results in complaints from raisl that the table 'Assets' doesn't exist, which is true... Any suggestions on how to model the relationship I described would be much appreciated! Yoram -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.