Class: Arel::Attributes::Relation

Inherits:
Attribute
  • Object
show all
Defined in:
lib/arel/nodes/relation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relation, name, collection = false, for_write = false) ⇒ Relation

Returns a new instance of Relation.



7
8
9
10
11
12
# File 'lib/arel/nodes/relation.rb', line 7

def initialize(relation, name, collection = false, for_write=false)
  self[:relation] = relation
  self[:name] = name
  @collection = collection
  @for_write = for_write
end

Instance Attribute Details

#collectionObject

Returns the value of attribute collection.



5
6
7
# File 'lib/arel/nodes/relation.rb', line 5

def collection
  @collection
end

#for_writeObject

Returns the value of attribute for_write.



5
6
7
# File 'lib/arel/nodes/relation.rb', line 5

def for_write
  @for_write
end

Instance Method Details

#able_to_type_cast?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/arel/nodes/relation.rb', line 14

def able_to_type_cast?
  relation.able_to_type_cast?
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
# File 'lib/arel/nodes/relation.rb', line 22

def eql? other
  self.class == other.class &&
    self.relation == other.relation &&
    self.name == other.name &&
    self.collection == other.collection
end

#table_nameObject



18
19
20
# File 'lib/arel/nodes/relation.rb', line 18

def table_name
  nil
end

#type_cast_for_database(value) ⇒ Object



29
30
31
# File 'lib/arel/nodes/relation.rb', line 29

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