diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2016-10-23 09:19:54 +0300 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2016-10-23 09:19:54 +0300 |
commit | 331d080a66fe90609f76a5d6b4e9b844186f78cf (patch) | |
tree | f6783903e3c43fbe50630aeb255f8a1b7bd04e3b /activerecord/lib | |
parent | 52852733d28c22199cafaf392a96745644967f9b (diff) | |
download | rails-331d080a66fe90609f76a5d6b4e9b844186f78cf.tar.gz rails-331d080a66fe90609f76a5d6b4e9b844186f78cf.tar.bz2 rails-331d080a66fe90609f76a5d6b4e9b844186f78cf.zip |
Revert "Made ActiveRecord consistently use ActiveRecord::Type (not"
This reverts commit 671eb742eec77b5c8281ac2a2e3976ef32a6e424.
This is not a change we would like moving forward.
Diffstat (limited to 'activerecord/lib')
6 files changed, 7 insertions, 17 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/query.rb b/activerecord/lib/active_record/attribute_methods/query.rb index 05f0e974b6..10498f4322 100644 --- a/activerecord/lib/active_record/attribute_methods/query.rb +++ b/activerecord/lib/active_record/attribute_methods/query.rb @@ -19,7 +19,7 @@ module ActiveRecord if Numeric === value || value !~ /[^0-9]/ !value.to_i.zero? else - return false if ActiveRecord::Type::Boolean::FALSE_VALUES.include?(value) + return false if ActiveModel::Type::Boolean::FALSE_VALUES.include?(value) !value.blank? end elsif value.respond_to?(:zero?) diff --git a/activerecord/lib/active_record/type.rb b/activerecord/lib/active_record/type.rb index 84373dddf2..0b48d2186a 100644 --- a/activerecord/lib/active_record/type.rb +++ b/activerecord/lib/active_record/type.rb @@ -1,6 +1,4 @@ require "active_model/type" -require "active_record/type/helpers" -require "active_record/type/value" require "active_record/type/internal/abstract_json" require "active_record/type/internal/timezone" @@ -50,6 +48,7 @@ module ActiveRecord end end + Helpers = ActiveModel::Type::Helpers BigInteger = ActiveModel::Type::BigInteger Binary = ActiveModel::Type::Binary Boolean = ActiveModel::Type::Boolean @@ -60,6 +59,7 @@ module ActiveRecord String = ActiveModel::Type::String Text = ActiveModel::Type::Text UnsignedInteger = ActiveModel::Type::UnsignedInteger + Value = ActiveModel::Type::Value register(:big_integer, Type::BigInteger, override: false) register(:binary, Type::Binary, override: false) diff --git a/activerecord/lib/active_record/type/helpers.rb b/activerecord/lib/active_record/type/helpers.rb deleted file mode 100644 index a32ccd4bc3..0000000000 --- a/activerecord/lib/active_record/type/helpers.rb +++ /dev/null @@ -1,5 +0,0 @@ -module ActiveRecord - module Type - Helpers = ActiveModel::Type::Helpers - end -end diff --git a/activerecord/lib/active_record/type/internal/abstract_json.rb b/activerecord/lib/active_record/type/internal/abstract_json.rb index 67028546e4..e19c5a14da 100644 --- a/activerecord/lib/active_record/type/internal/abstract_json.rb +++ b/activerecord/lib/active_record/type/internal/abstract_json.rb @@ -1,8 +1,8 @@ module ActiveRecord module Type module Internal # :nodoc: - class AbstractJson < Type::Value # :nodoc: - include Type::Helpers::Mutable + class AbstractJson < ActiveModel::Type::Value # :nodoc: + include ActiveModel::Type::Helpers::Mutable def type :json diff --git a/activerecord/lib/active_record/type/serialized.rb b/activerecord/lib/active_record/type/serialized.rb index ca12c83b1a..ac9134bfcb 100644 --- a/activerecord/lib/active_record/type/serialized.rb +++ b/activerecord/lib/active_record/type/serialized.rb @@ -1,7 +1,7 @@ module ActiveRecord module Type - class Serialized < DelegateClass(Type::Value) # :nodoc: - include Type::Helpers::Mutable + class Serialized < DelegateClass(ActiveModel::Type::Value) # :nodoc: + include ActiveModel::Type::Helpers::Mutable attr_reader :subtype, :coder diff --git a/activerecord/lib/active_record/type/value.rb b/activerecord/lib/active_record/type/value.rb deleted file mode 100644 index 89ef29106b..0000000000 --- a/activerecord/lib/active_record/type/value.rb +++ /dev/null @@ -1,5 +0,0 @@ -module ActiveRecord - module Type - class Value < ActiveModel::Type::Value; end - end -end |