Class: Prequel::Relations::Relation
- Inherits:
-
Object
- Object
- Prequel::Relations::Relation
show all
- Defined in:
- lib/prequel/relations/relation.rb
Instance Method Summary
collapse
Instance Method Details
#find(id) ⇒ Object
10
11
12
|
# File 'lib/prequel/relations/relation.rb', line 10
def find(id)
where(:id => id).first
end
|
#get_column(name) ⇒ Object
38
39
40
41
|
# File 'lib/prequel/relations/relation.rb', line 38
def get_column(name)
resolved = resolve(name)
derive(resolved) if resolved
end
|
#join(right, predicate) ⇒ Object
18
19
20
|
# File 'lib/prequel/relations/relation.rb', line 18
def join(right, predicate)
InnerJoin.new(self, right, predicate)
end
|
#project(*symbols) ⇒ Object
22
23
24
|
# File 'lib/prequel/relations/relation.rb', line 22
def project(*symbols)
Projection.new(self, *symbols)
end
|
#query ⇒ Object
6
7
8
|
# File 'lib/prequel/relations/relation.rb', line 6
def query
Sql::Query.new(self).build
end
|
#singular_table_ref(query) ⇒ Object
30
31
32
|
# File 'lib/prequel/relations/relation.rb', line 30
def singular_table_ref(query)
query.add_subquery(self)
end
|
#table_ref(query) ⇒ Object
26
27
28
|
# File 'lib/prequel/relations/relation.rb', line 26
def table_ref(query)
singular_table_ref(query)
end
|
#to_relation ⇒ Object
34
35
36
|
# File 'lib/prequel/relations/relation.rb', line 34
def to_relation
self
end
|
#where(predicate) ⇒ Object
14
15
16
|
# File 'lib/prequel/relations/relation.rb', line 14
def where(predicate)
Selection.new(self, predicate)
end
|