Class: Arel::Table
Class Attribute Summary collapse
Instance Attribute Summary collapse
Instance Method Summary
collapse
#as
#coalesce, #create_and, #create_false, #create_join, #create_on, #create_string_join, #create_table_alias, #create_true, #grouping, #lower
Constructor Details
permalink
#initialize(name, as: nil, klass: nil, type_caster: klass&.type_caster) ⇒ Table
Returns a new instance of Table.
[View source]
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'activerecord/lib/arel/table.rb', line 16
def initialize(name, as: nil, klass: nil, type_caster: klass&.type_caster)
@name = name.to_s
@klass = klass
@type_caster = type_caster
if as.to_s == @name
as = nil
end
@table_alias = as
end
|
Class Attribute Details
Returns the value of attribute engine
9
10
11
|
# File 'activerecord/lib/arel/table.rb', line 9
def engine
@engine
end
|
Instance Attribute Details
permalink
#name ⇒ Object
Also known as:
table_name
Returns the value of attribute name
11
12
13
|
# File 'activerecord/lib/arel/table.rb', line 11
def name
@name
end
|
Returns the value of attribute table_alias
11
12
13
|
# File 'activerecord/lib/arel/table.rb', line 11
def table_alias
@table_alias
end
|
Instance Method Details
[View source]
82
83
84
85
86
|
# File 'activerecord/lib/arel/table.rb', line 82
def [](name, table = self)
name = name.to_s if name.is_a?(Symbol)
name = @klass.attribute_aliases[name] || name if @klass
Attribute.new(table, name)
end
|
permalink
#able_to_type_cast? ⇒ Boolean
[View source]
110
111
112
|
# File 'activerecord/lib/arel/table.rb', line 110
def able_to_type_cast?
!type_caster.nil?
end
|
permalink
#eql?(other) ⇒ Boolean
Also known as:
==
[View source]
95
96
97
98
99
|
# File 'activerecord/lib/arel/table.rb', line 95
def eql?(other)
self.class == other.class &&
self.name == other.name &&
self.table_alias == other.table_alias
end
|
[View source]
54
55
56
|
# File 'activerecord/lib/arel/table.rb', line 54
def group(*columns)
from.group(*columns)
end
|
[View source]
88
89
90
91
92
93
|
# File 'activerecord/lib/arel/table.rb', line 88
def hash
@name.hash
end
|
[View source]
78
79
80
|
# File 'activerecord/lib/arel/table.rb', line 78
def having(expr)
from.having expr
end
|
[View source]
58
59
60
|
# File 'activerecord/lib/arel/table.rb', line 58
def order(*expr)
from.order(*expr)
end
|
[View source]
50
51
52
|
# File 'activerecord/lib/arel/table.rb', line 50
def outer_join(relation)
join(relation, Nodes::OuterJoin)
end
|
[View source]
66
67
68
|
# File 'activerecord/lib/arel/table.rb', line 66
def project(*things)
from.project(*things)
end
|
[View source]
74
75
76
|
# File 'activerecord/lib/arel/table.rb', line 74
def skip(amount)
from.skip amount
end
|
[View source]
70
71
72
|
# File 'activerecord/lib/arel/table.rb', line 70
def take(amount)
from.take amount
end
|
permalink
#type_cast_for_database(attr_name, value) ⇒ Object
[View source]
102
103
104
|
# File 'activerecord/lib/arel/table.rb', line 102
def type_cast_for_database(attr_name, value)
type_caster.type_cast_for_database(attr_name, value)
end
|
[View source]
106
107
108
|
# File 'activerecord/lib/arel/table.rb', line 106
def type_for_attribute(name)
type_caster.type_for_attribute(name)
end
|
[View source]
62
63
64
|
# File 'activerecord/lib/arel/table.rb', line 62
def where(condition)
from.where condition
end
|