Created
November 28, 2010 14:15
-
-
Save godfat/718960 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://marklunds.com/articles/one/402 | |
module ActiveRecord | |
module ConnectionAdapters # :nodoc: | |
module Quoting | |
# Convert dates and times to UTC so that the following two will be equivalent: | |
# Event.all(:conditions => ["start_time > ?", Time.zone.now]) | |
# Event.all(:conditions => ["start_time > ?", Time.now]) | |
def quoted_date(value) | |
value.respond_to?(:utc) ? value.dup.utc.to_s(:db) : value.to_s(:db) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment