mongo mapper with STI with more than one type?

Posted by holden on Stack Overflow See other posts from Stack Overflow or by holden
Published on 2010-03-15T23:30:59Z Indexed on 2010/03/16 0:29 UTC
Read the original article Hit count: 739

I have a series of models all which inherit from a base model Properties

For example Bars, Restaurants, Cafes, etc.

class Property
  include MongoMapper::Document

  key :name, String
  key :_type, String
end

class Bar < Property

What I'm wondering is what to do with the case when a record happens to be both a Bar & a Restaurant? Is there a way for a single object to inherit the attributes of both models? And how would it work with the key :_type?

© Stack Overflow or respective owner

Related posts about mongomapper

Related posts about mongodb