Skip to content

Instantly share code, notes, and snippets.

@vijaydev
Created December 20, 2011 19:47
Show Gist options
  • Save vijaydev/1502952 to your computer and use it in GitHub Desktop.
Save vijaydev/1502952 to your computer and use it in GitHub Desktop.
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