Model inheritance #332

Closed
stijnbe opened this Issue Mar 18, 2013 · 1 comment

Comments

Projects
None yet
3 participants

stijnbe commented Mar 18, 2013

How would you implement model inheritance using Geddy? Let's say you wan't a model for animal, dog and cat. Where dog and cat inherit from animal.

Contributor

mde commented Mar 18, 2013

ActiveRecord supports single-table inheritance, like this: http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html

Our Model layer doesn't support this yet. The best way to work around this at present is to use composition instead. .So, for example, instead of having an Admin type that descends from User, you'd add an associated AdminRole to the User, that adds the administrative capabilities.

I've added a ticket for Model for this: mde/model#37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment