Method: SQL::Maker::Select#add_join
- Defined in:
- lib/sql/maker/select.rb
#add_join(*args) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/sql/maker/select.rb', line 110 def add_join(*args) # :user => { :type => 'inner', :table => 'config', :condition => {'user.user_id' => 'config.user_id'} } # [ subquery, 'bar' ] => { :type => 'inner', :table => 'config', :condition => {'user.user_id' => 'config.user_id'} } table, joins = parse_args(*args) table, as = parse_args(*table) if table.respond_to?(:as_sql) self.subqueries += table.bind table = '(' + table.as_sql + ')' else table = table.to_s end self.joins += [{ :table => [ table, as ], :joins => joins }] self end |