Module: Property::Attribute

Defined in:
lib/property/attribute.rb

Overview

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 Marshal through Property::Serialization::Marshal.

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

Defined Under Namespace

Modules: Base, ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



14
15
16
17
18
19
20
# 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