Skip to content

Instantly share code, notes, and snippets.

@vijaydev vijaydev/to_sql.rb
Created Dec 20, 2011

Embed
What would you like to do?
def visit_Arel_Nodes_SelectStatement o
puts caller
[
(visit(o.with) if o.with),
o.cores.map { |x| visit_Arel_Nodes_SelectCore x }.join,
("ORDER BY #{o.orders.map { |x| visit x }.join(', ')}" unless o.orders.empty?),
(visit(o.limit) if o.limit),
(visit(o.offset) if o.offset),
(visit(o.lock) if o.lock),
].compact.join ' '
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.