Class: ThinkingSphinx::ActiveRecord::Attribute::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/active_record/attribute/type.rb

Constant Summary

UPDATEABLE_TYPES =
[:integer, :timestamp, :boolean, :float]

Instance Method Summary (collapse)

Constructor Details

- (Type) initialize(attribute, model)



4
5
6
# File 'lib/thinking_sphinx/active_record/attribute/type.rb', line 4

def initialize(attribute, model)
  @attribute, @model = attribute, model
end

Instance Method Details

- (Boolean) multi?



8
9
10
# File 'lib/thinking_sphinx/active_record/attribute/type.rb', line 8

def multi?
  @multi ||= attribute.options[:multi] || multi_from_associations
end

- (Boolean) timestamp?



12
13
14
# File 'lib/thinking_sphinx/active_record/attribute/type.rb', line 12

def timestamp?
  type == :timestamp
end

- (Object) type



16
17
18
# File 'lib/thinking_sphinx/active_record/attribute/type.rb', line 16

def type
  @type ||= attribute.options[:type] || type_from_database
end

- (Object) type=(value)



20
21
22
# File 'lib/thinking_sphinx/active_record/attribute/type.rb', line 20

def type=(value)
  @type = attribute.options[:type] = value
end

- (Boolean) updateable?



24
25
26
# File 'lib/thinking_sphinx/active_record/attribute/type.rb', line 24

def updateable?
  UPDATEABLE_TYPES.include?(type) && single_column_reference?
end