diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-02 20:59:19 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-02 20:59:19 -0300 |
commit | 540a81852618ad70695fd2902c4a8a16b0be3cac (patch) | |
tree | ec8172cb3e50e37ca1a45e4e5856190ecf5ca4a9 /activerecord/lib | |
parent | 41740be7c43c3454278c9ecc65772922ec718926 (diff) | |
parent | e8d6ba218ac019591f1d68f4f54d4243b606893c (diff) | |
download | rails-540a81852618ad70695fd2902c4a8a16b0be3cac.tar.gz rails-540a81852618ad70695fd2902c4a8a16b0be3cac.tar.bz2 rails-540a81852618ad70695fd2902c4a8a16b0be3cac.zip |
Merge pull request #18307 from brainopia/datetime_regression
Fully support datetime values in AR::Type::DateTime#type_cast_for_database
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/type/date_time.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/type/date_time.rb b/activerecord/lib/active_record/type/date_time.rb index 5f19608a33..0a737815bc 100644 --- a/activerecord/lib/active_record/type/date_time.rb +++ b/activerecord/lib/active_record/type/date_time.rb @@ -11,7 +11,11 @@ module ActiveRecord zone_conversion_method = ActiveRecord::Base.default_timezone == :utc ? :getutc : :getlocal if value.acts_like?(:time) - value.send(zone_conversion_method) + if value.respond_to?(zone_conversion_method) + value.send(zone_conversion_method) + else + value + end else super end |