Skip to content

Instantly share code, notes, and snippets.

@godfat godfat/gist:718960
Created Nov 28, 2010

Embed
What would you like to do?
# 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
You can’t perform that action at this time.