module Property::Attribute

The Property::Attribute module is included in ActiveRecord model for CRUD operations on properties. These ared stored in a table field called ‘properties’ and are accessed with properties or prop and properties= methods.

The properties are encoded et decoded with a serialization tool than you can change by including a Serialization module that should implement ‘encode_properties’ and ‘decode_properties’. The default is to use JSON through Property::Serialization::JSON.

The attributes= method filters native attributes and properties in order to store them apart.

Public Class Methods

included(base) click to toggle source
# File lib/property/attribute.rb, line 14
def self.included(base)
  base.class_eval do
    include Base
    after_validation   :dump_properties
    alias_method_chain :attributes=,  :properties
  end
end