Method: Rusql::Query#from

Defined in:
lib/rusql/query.rb

#from(t) ⇒ Object

Raises:



46
47
48
49
50
51
52
53
54
55
# File 'lib/rusql/query.rb', line 46

def from(t)
  # so that we can have ActiveRecord hacks :/ 
  final_table = t.is_a?(Table) ? t : ( t.respond_to?(:as_rusql_table) ? t.as_rusql_table : nil )
  raise TypeException.new(Table, t.class) if final_table.nil?

  new_one = self.duplicate
  new_one.instance_variable_set(:@from_table, final_table)

  new_one
end