Rails Exporter Plugin
Relations
http://rails.kirschekreativ.de/relations.html

Copyright © 2013 Joerg Kirschstein

 

Relations

There are several ways the plugin processes relations:

1:1
A direct relation between two tables with a "has_one" relation.

1:n
A direct relation between two tables with a "has_many"/"belongs_to" relation.

n:m

  • Direct: if two tables have a direct many to many relation, an additional join table is created.
  • Join Table: if a join table exists in rail convention naming, the join table is kept.
  • "_has_": if a join table has a MySQL convention name, its converted to a rails join table.
  • Any wrong name: if a join tables exists, but has a wrong name, its converted to a rails join table.
  • Additional columns: if a join table has additional columns, a rails join table with a model for the join table is created.

Polymorphic
If a corresponding column name "_type" is found in a n:m relation with an "_id" column, the plugin expects a polymorphic relation.

Additional attributes
Mandatory: if set in Workbench, the "Nullify" option is set in the model.