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.



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

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.



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

def collection
  @collection
end

#for_writeObject

Returns the value of attribute for_write.



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

def for_write
  @for_write
end

Instance Method Details

#able_to_type_cast?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/arel/nodes/relation.rb', line 16

def able_to_type_cast?
  relation.able_to_type_cast?
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#table_nameObject



20
21
22
# File 'lib/arel/nodes/relation.rb', line 20

def table_name
  nil
end

#type_cast_for_database(value) ⇒ Object



31
32
33
# File 'lib/arel/nodes/relation.rb', line 31

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