Module: Property::StoredColumn

Defined in:
lib/property/stored_column.rb

Overview

This module should be inserted in an ActiveRecord class that stores a single property definition in the database and is used with StoredRole.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/property/stored_column.rb', line 5

def self.included(base)
  base.before_validation :set_index
end

Instance Method Details

#defaultObject

Default values not currently supported.



10
11
12
# File 'lib/property/stored_column.rb', line 10

def default
  nil
end

#klassObject

Used to store serialized properties. Should return the class to serialize.



15
16
17
# File 'lib/property/stored_column.rb', line 15

def klass
  nil
end

#optionsObject

No supported options yet.



20
21
22
# File 'lib/property/stored_column.rb', line 20

def options
  {:index => (index.blank? ? nil : index)}
end

#type_cast(value) ⇒ Object

Dummy, can be reimplemented in the class storing the column.



25
26
27
# File 'lib/property/stored_column.rb', line 25

def type_cast(value)
  nil
end