Rails Exporter Plugin
Polymorphic Relation
http://rails.kirschekreativ.de/polymorphic-relation.html

Copyright © 2013 Joerg Kirschstein

 

Polymorphic Relation

Four tables are converted to model-, migration-, schema- and seeds files. Contains three polymorphic relationships which are automatically detected by corresponding column "_type".

MySQL Schema


MODEL FILES


MIGRATION FILES


SCHEMA FILE


SEEDS FILE [excerpt]


CMD 'rake db:setup'


SEEDED DATABASE [excerpt]