Class: ActiveRecord::CustomAttributes::CustomAttributeDefinitionHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/custom_attributes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(extra_field_types) ⇒ CustomAttributeDefinitionHelper

Returns a new instance of CustomAttributeDefinitionHelper.



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/active_record/custom_attributes.rb', line 54

def initialize extra_field_types
  @defined_attributes = {}
  @defined_validations = {}

  extra_field_types.each do |key, value|
    class_eval do
      define_method key do |*args|
        define_field(key, *args)
      end
    end
  end
end

Instance Attribute Details

#defined_attributesObject (readonly)

Returns the value of attribute defined_attributes.



73
74
75
# File 'lib/active_record/custom_attributes.rb', line 73

def defined_attributes
  @defined_attributes
end

#defined_validationsObject (readonly)

Returns the value of attribute defined_validations.



73
74
75
# File 'lib/active_record/custom_attributes.rb', line 73

def defined_validations
  @defined_validations
end