Parent

Included Modules

Class Index [+]

Quicksearch

Arel::Table

Attributes

engine[RW]
name[RW]
engine[RW]
aliases[RW]
table_alias[RW]

Public Class Methods

new(name, engine = Table.engine) click to toggle source
    # File lib/arel/table.rb, line 14
14:     def initialize name, engine = Table.engine
15:       @name    = name.to_s
16:       @engine  = engine
17:       @columns = nil
18:       @aliases = []
19:       @table_alias = nil
20:       @primary_key = nil
21: 
22:       if Hash === engine
23:         @engine  = engine[:engine] || Table.engine
24: 
25:         # Sometime AR sends an :as parameter to table, to let the table know
26:         # that it is an Alias.  We may want to override new, and return a
27:         # TableAlias node?
28:         @table_alias = engine[:as] unless engine[:as].to_s == @name
29:       end
30:     end

Public Instance Methods

[](name) click to toggle source
     # File lib/arel/table.rb, line 114
114:     def [] name
115:       ::Arel::Attribute.new self, name
116:     end
alias(name = "#{self.name}_2") click to toggle source
    # File lib/arel/table.rb, line 45
45:     def alias name = "#{self.name}_2"
46:       Nodes::TableAlias.new(self, name).tap do |node|
47:         @aliases << node
48:       end
49:     end
columns() click to toggle source
     # File lib/arel/table.rb, line 103
103:     def columns
104:       if $VERBOSE
105:         warn (#{caller.first}) Arel::Table#columns is deprecated and will be removed inArel 4.0.0 with no replacement.  PEW PEW PEW!!!
106:       end
107:       @columns ||=
108:         attributes_for @engine.connection.columns(@name, "#{@name} Columns")
109:     end
from(table) click to toggle source
    # File lib/arel/table.rb, line 51
51:     def from table
52:       SelectManager.new(@engine, table)
53:     end
group(*columns) click to toggle source
    # File lib/arel/table.rb, line 75
75:     def group *columns
76:       from(self).group(*columns)
77:     end
having(expr) click to toggle source
     # File lib/arel/table.rb, line 99
 99:     def having expr
100:       from(self).having expr
101:     end
insert_manager() click to toggle source
     # File lib/arel/table.rb, line 122
122:     def insert_manager
123:       InsertManager.new(@engine)
124:     end
join(relation, klass = Nodes::InnerJoin) click to toggle source
    # File lib/arel/table.rb, line 63
63:     def join relation, klass = Nodes::InnerJoin
64:       return from(self) unless relation
65: 
66:       case relation
67:       when String, Nodes::SqlLiteral
68:         raise if relation.blank?
69:         klass = Nodes::StringJoin
70:       end
71: 
72:       from(self).join(relation, klass)
73:     end
joins(manager) click to toggle source
    # File lib/arel/table.rb, line 55
55:     def joins manager
56:       if $VERBOSE
57:         warn "joins is deprecated and will be removed in 4.0.0"
58:         warn "please remove your call to joins from #{caller.first}"
59:       end
60:       nil
61:     end
order(*expr) click to toggle source
    # File lib/arel/table.rb, line 79
79:     def order *expr
80:       from(self).order(*expr)
81:     end
primary_key() click to toggle source
    # File lib/arel/table.rb, line 32
32:     def primary_key
33:       if $VERBOSE
34:         warn primary_key (#{caller.first}) is deprecated and will be removed in ARel 4.0.0
35:       end
36:       @primary_key ||= begin
37:         primary_key_name = @engine.connection.primary_key(name)
38:         # some tables might be without primary key
39:         primary_key_name && self[primary_key_name]
40:       end
41:     end
project(*things) click to toggle source
    # File lib/arel/table.rb, line 87
87:     def project *things
88:       from(self).project(*things)
89:     end
select_manager() click to toggle source
     # File lib/arel/table.rb, line 118
118:     def select_manager
119:       SelectManager.new(@engine)
120:     end
skip(amount) click to toggle source
    # File lib/arel/table.rb, line 95
95:     def skip amount
96:       from(self).skip amount
97:     end
take(amount) click to toggle source
    # File lib/arel/table.rb, line 91
91:     def take amount
92:       from(self).take amount
93:     end
where(condition) click to toggle source
    # File lib/arel/table.rb, line 83
83:     def where condition
84:       from(self).where condition
85:     end

Private Instance Methods

attributes_for(columns) click to toggle source
     # File lib/arel/table.rb, line 128
128:     def attributes_for columns
129:       return nil unless columns
130: 
131:       columns.map do |column|
132:         Attributes.for(column).new self, column.name.to_sym
133:       end
134:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.