Module: ActiveRecord::ConnectionAdapters::Elasticsearch::AttributeMethods

Extended by:
ActiveSupport::Concern
Included in:
TableAliasDefinition, TableMappingDefinition, TableSettingDefinition
Defined in:
lib/active_record/connection_adapters/elasticsearch/schema_definitions/attribute_methods.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#stateObject (readonly)

Returns the value of attribute state.



10
11
12
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/attribute_methods.rb', line 10

def state
  @state
end

Class Method Details

.build_attribute_methods!(*args) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/attribute_methods.rb', line 83

def build_attribute_methods!(*args)
  opts       = args.extract_options!
  opts[:key] ||= :attributes

  args.each do |name|
    class_eval <<-CODE, __FILE__, __LINE__ + 1
      def #{name}
        __get_attribute(:#{name})
      end
      
      def #{name}=(value)
        __set_attribute(:#{name}, value)
      end
    CODE
  end
end

Instance Method Details

#error_messagesObject



12
13
14
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/attribute_methods.rb', line 12

def error_messages
  errors.full_messages.join(', ')
end

#state?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/attribute_methods.rb', line 22

def state?
  state.present?
end

#with_state(state) ⇒ Object



16
17
18
19
20
# File 'lib/active_record/connection_adapters/elasticsearch/schema_definitions/attribute_methods.rb', line 16

def with_state(state)
  @state = state

  self
end