Thursday, July 15, 2010

Graft Rails Model Inheritance

We've pushed out a new feature for Graft.

Up until now, each exported class has directly translated across to a Ruby on Rails Model, without regard for inheritance in the models.

Exported Rails Models will now include all the primitive of the Graft class, as well as any superclasses. So if you have BMW inherit from Car, and Car has a "license" of type "String" - both Car and BMW will have the license property. The same applies to relationships.

We've put up an example model that should help illustrate. You can export it to Rails using the instructions listed under the Export tab.

It's fairly new, so if you've got any queries or strike any issues, drop us a line via Twitter @jodoro or email

Right now all classes are generated as Models, so you can consider this the superset. Later releases will allow for finer-grained control, such as flattening (e.g Single Table Inheritance).

Jon - @jonathannen.

No comments: