Module: HasCustomFields

Defined in:
lib/has_custom_fields.rb,
lib/has_custom_fields/base.rb,
lib/has_custom_fields/railtie.rb,
lib/has_custom_fields/version.rb,
lib/has_custom_fields/class_methods.rb,
lib/has_custom_fields/instance_methods.rb

Overview

HasCustomFields allow for the Entity-attribute-value model (EAV), also known as object-attribute-value model and open schema on any of your ActiveRecord models.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: Base, InvalidScopeError, Railtie

Constant Summary collapse

ALLOWABLE_TYPES =
['select', 'checkbox', 'text', 'date']
VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.insertObject



5
6
7
8
9
10
# File 'lib/has_custom_fields/railtie.rb', line 5

def HasCustomFields.insert
  unless ActiveRecord::Base.included_modules.include?(HasCustomFields::InstanceMethods)
    ActiveRecord::Base.extend HasCustomFields::ClassMethods
    ActiveRecord::Base.send :include, HasCustomFields::InstanceMethods
  end
end