You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When doing OO programming, it's quite a common behavior to have a base super class which can have properties such as created_at, updated_at, or whatever your all subclassed models will need. When using a common ORM like ActiveRecord, all of the objects inherit from ActiveRecord::Base, and the model often has a has_one relationship with what it's "inheriting", it's not really an expected behavior in the functionality that Realm is attempting to provide.
If the goal of Realm is to abstract away the database side of your code and treat persisted models as regular models, then it would make sense to support direct subclassing of objects which inherit from RLMObject. Besides clarity, this would have the added benefit of lowering the barrier for someone who to add persistence into a project which does not have it, without re-architecting the models, in the same way that CoreData allows.
The text was updated successfully, but these errors were encountered:
Thanks for the write-up @mergesort. We definitely want to allow something like this, be it via inheritance or via composition. It’s hard to do well (read: while maintaining performance with millions of objects composed from a complex hierarchy of inheritances), but we have a few ideas we’re working on…
When doing OO programming, it's quite a common behavior to have a base super class which can have properties such as
created_at
,updated_at
, or whatever your all subclassed models will need. When using a common ORM like ActiveRecord, all of the objects inherit fromActiveRecord::Base
, and the model often has ahas_one
relationship with what it's "inheriting", it's not really an expected behavior in the functionality that Realm is attempting to provide.If the goal of Realm is to abstract away the database side of your code and treat persisted models as regular models, then it would make sense to support direct subclassing of objects which inherit from
RLMObject
. Besides clarity, this would have the added benefit of lowering the barrier for someone who to add persistence into a project which does not have it, without re-architecting the models, in the same way that CoreData allows.The text was updated successfully, but these errors were encountered: