diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-02-10 11:52:01 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-02-10 11:55:59 -0700 |
commit | f1a0fa9e19b7e4ccaea191fc6cf0613880222ee7 (patch) | |
tree | 655c1e521e1bbe2a6c3cec8b8178bd7dc843c187 /activerecord/lib/active_record/connection_adapters/postgresql | |
parent | f926c1c953df6037654732c57a6c6b23db91c9fa (diff) | |
download | rails-f1a0fa9e19b7e4ccaea191fc6cf0613880222ee7.tar.gz rails-f1a0fa9e19b7e4ccaea191fc6cf0613880222ee7.tar.bz2 rails-f1a0fa9e19b7e4ccaea191fc6cf0613880222ee7.zip |
Refactor microsecond precision to be database agnostic
The various databases don't actually need significantly different
handling for this behavior, and they can achieve it without knowing
about the type of the object.
The old implementation was returning a string, which will cause problems
such as breaking TZ aware attributes, and making it impossible for the
adapters to supply their logic for time objects.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb index 2fe61eeb77..b9e7894e5c 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb @@ -5,15 +5,6 @@ module ActiveRecord class DateTime < Type::DateTime # :nodoc: include Infinity - def type_cast_for_database(value) - if has_precision? && value.acts_like?(:time) && value.year <= 0 - bce_year = format("%04d", -value.year + 1) - super.sub(/^-?\d+/, bce_year) + " BC" - else - super - end - end - def cast_value(value) if value.is_a?(::String) case value |