I have 2 main entities, UserProfile and Property. Basically, the UserProfile needs to maintain 3 different lists of Properties (note, each list type will have additional properties)
Does anyone see anything wrong with the following design for doing so:
class UserProfile < ActiveRecord::Base
has_many :shortlists
has_many :booklists
has_many :proplists
end
class Shortlist < ActiveRecord::Base
has_and_belongs_to_many :properties
end
class Booklist < ActiveRecord::Base
has_and_belongs_to_many :properties
end
class Proplist < ActiveRecord::Base
has_and_belongs_to_many :properties
end
class Property < ActiveRecord::Base
has_and_belongs_to_many :shortlists
has_and_belongs_to_many :booklists
has_and_belongs_to_many :proplists
end
The other way I was considering is to use polymorphism for the Property entity, but not sure which way would be more 'the rails way'