I have 2 main objects, UserProfile and Property. Basically, UserProfile should support 3 different property lists (note: each type of list will have additional properties)
Does anyone see something wrong with the following design for this:
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
Another way I looked at is to use polymorphism for a Property object, but I'm not sure how there will be more “rail tracks”
source
share