Skip to content

Instantly share code, notes, and snippets.

@pond
Created October 11, 2013 01:18
Show Gist options
  • Save pond/6928197 to your computer and use it in GitHub Desktop.
Save pond/6928197 to your computer and use it in GitHub Desktop.
def visit_Arel_Nodes_Between o
if (o.right.children[0].class == Date && o.right.children[1].class == Date)
min = o.right.children[ 0 ]
max = o.right.children[ 1 ] + 1
"(#{visit o.left} >= #{visit min} AND #{visit o.left} < #{visit max})"
else
"#{visit o.left} BETWEEN #{visit o.right}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment