Module: ActiveRecord::CustomAttributes::Core

Defined in:
lib/active_record/custom_attributes.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



109
110
111
112
113
114
115
116
117
118
# File 'lib/active_record/custom_attributes.rb', line 109

def self.included(base)
  base.send :include, ActiveRecord::CustomAttributes::Core::InstanceMethods
  base.extend ActiveRecord::CustomAttributes::Core::ClassMethods
  base.has_many :external_custom_attributes, :class_name => "ActiveRecord::CustomAttributes::CustomAttributeModel",
                :as => :item, :dependent => :destroy

  base.before_save :cache_custom_attributes
  base.after_save :save_custom_attributes
  base.validate :validate_custom_attributes
end