Class: Arel::Attributes::Attribute

Inherits:
Struct show all
Includes:
Arel::AliasPredication, Expressions, Math, OrderPredications, Predications
Defined in:
activerecord/lib/arel/attributes/attribute.rb

Direct Known Subclasses

Boolean, Decimal, Float, Integer, String, Time, Undefined

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Math

#&, #*, #+, #-, #/, #<<, #>>, #^, #|, #~@

Methods included from OrderPredications

#asc, #desc

Methods included from Arel::AliasPredication

#as

Methods included from Predications

#between, #concat, #does_not_match, #does_not_match_all, #does_not_match_any, #does_not_match_regexp, #eq, #eq_all, #eq_any, #gt, #gt_all, #gt_any, #gteq, #gteq_all, #gteq_any, #in, #in_all, #in_any, #is_distinct_from, #is_not_distinct_from, #lt, #lt_all, #lt_any, #lteq, #lteq_all, #lteq_any, #matches, #matches_all, #matches_any, #matches_regexp, #not_between, #not_eq, #not_eq_all, #not_eq_any, #not_in, #not_in_all, #not_in_any, #when

Methods included from Expressions

#average, #count, #extract, #maximum, #minimum, #sum

Methods inherited from Struct

#as_json

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



5
6
7
# File 'activerecord/lib/arel/attributes/attribute.rb', line 5

def name
  @name
end

#relationObject

Returns the value of attribute relation

Returns:

  • (Object)

    the current value of relation



5
6
7
# File 'activerecord/lib/arel/attributes/attribute.rb', line 5

def relation
  @relation
end

Instance Method Details

#able_to_type_cast?Boolean

Returns:



22
23
24
# File 'activerecord/lib/arel/attributes/attribute.rb', line 22

def able_to_type_cast?
  relation.able_to_type_cast?
end

#lowerObject

Create a node for lowering this attribute



14
15
16
# File 'activerecord/lib/arel/attributes/attribute.rb', line 14

def lower
  relation.lower self
end

#type_cast_for_database(value) ⇒ Object



18
19
20
# File 'activerecord/lib/arel/attributes/attribute.rb', line 18

def type_cast_for_database(value)
  relation.type_cast_for_database(name, value)
end