contents
description
The Property gem lets you define “properties” for your models. Properties behave like normal rails attributes with the following differences:
what you gain
- they should be faster (less type casting)
- you can add properties to sub-classes without affecting the parent class
- you can dynamically define properties in model instances when needed (virtual classes)
- you can use roles to group attributes together
- you can easily define complex indices
what you loose
- they are harder to use in queries (must use index tables)
- you could directly index the json data, but that might not be optimal
Properties are stored into a single database column and are declared from within the model or by using roles).
This class is 100% compatible with ActiveRecord. This means that if you have been using a model with normal attributes, you should be able migrate the data and copy paste the table definition from the schema into your model and it should work as before, except for sql queries of course.
source code
The code is on github