Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi Table Inheritance with rails 3

Are there standards or best practices yet when it comes to multi table inheritance in rails 3? So far the best article I could find was:

http://mediumexposure.com/multiple-table-inheritance-active-record/

But even that needed some changes(e.g. moving the requires to an initializer instead of the old /config/environment.rb)

Any better resources / standards?

like image 413
jtesch Avatar asked Feb 16 '11 22:02

jtesch


2 Answers

For an easy way to do multi-table inheritance take a look at 'acts_as_relation' plugin https://github.com/hzamani/acts_as_relation.

like image 151
Hassan Avatar answered Nov 16 '22 15:11

Hassan


I recently forked a promising gem to implement multiple table inheritance and class inheritance in Rails. I have spent a few days subjecting it to rapid development, fixes, commenting and documentation and have re-released it as CITIER (Class Inheritance and Table Inheritance Embeddings for Rails).

Consider giving it a look: https://github.com/PeterHamilton/citier

It actually takes some concepts from that article you mention.

like image 24
Pete Hamilton Avatar answered Nov 16 '22 14:11

Pete Hamilton