diff options
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/type')
7 files changed, 37 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/type/binary.rb b/activerecord/lib/active_record/connection_adapters/type/binary.rb index 168d824d3d..e0ea226216 100644 --- a/activerecord/lib/active_record/connection_adapters/type/binary.rb +++ b/activerecord/lib/active_record/connection_adapters/type/binary.rb @@ -5,6 +5,10 @@ module ActiveRecord def type :binary end + + def binary? + true + end end end end diff --git a/activerecord/lib/active_record/connection_adapters/type/decimal.rb b/activerecord/lib/active_record/connection_adapters/type/decimal.rb index 9581cd5964..91957fe84b 100644 --- a/activerecord/lib/active_record/connection_adapters/type/decimal.rb +++ b/activerecord/lib/active_record/connection_adapters/type/decimal.rb @@ -2,6 +2,8 @@ module ActiveRecord module ConnectionAdapters module Type class Decimal < Value # :nodoc: + include Numeric + def type :decimal end diff --git a/activerecord/lib/active_record/connection_adapters/type/float.rb b/activerecord/lib/active_record/connection_adapters/type/float.rb index 2d436d4aa3..31d8e7d1d3 100644 --- a/activerecord/lib/active_record/connection_adapters/type/float.rb +++ b/activerecord/lib/active_record/connection_adapters/type/float.rb @@ -2,6 +2,8 @@ module ActiveRecord module ConnectionAdapters module Type class Float < Value # :nodoc: + include Numeric + def type :float end diff --git a/activerecord/lib/active_record/connection_adapters/type/integer.rb b/activerecord/lib/active_record/connection_adapters/type/integer.rb index b839e043ad..fbc72ae4ef 100644 --- a/activerecord/lib/active_record/connection_adapters/type/integer.rb +++ b/activerecord/lib/active_record/connection_adapters/type/integer.rb @@ -2,6 +2,8 @@ module ActiveRecord module ConnectionAdapters module Type class Integer < Value # :nodoc: + include Numeric + def type :integer end diff --git a/activerecord/lib/active_record/connection_adapters/type/numeric.rb b/activerecord/lib/active_record/connection_adapters/type/numeric.rb new file mode 100644 index 0000000000..a440de4d14 --- /dev/null +++ b/activerecord/lib/active_record/connection_adapters/type/numeric.rb @@ -0,0 +1,11 @@ +module ActiveRecord + module ConnectionAdapters + module Type + module Numeric # :nodoc: + def number? + true + end + end + end + end +end diff --git a/activerecord/lib/active_record/connection_adapters/type/string.rb b/activerecord/lib/active_record/connection_adapters/type/string.rb index d6c1c64834..24f9659c7b 100644 --- a/activerecord/lib/active_record/connection_adapters/type/string.rb +++ b/activerecord/lib/active_record/connection_adapters/type/string.rb @@ -6,6 +6,10 @@ module ActiveRecord :string end + def text? + true + end + private def cast_value(value) diff --git a/activerecord/lib/active_record/connection_adapters/type/value.rb b/activerecord/lib/active_record/connection_adapters/type/value.rb index a83f0e652d..506f402fef 100644 --- a/activerecord/lib/active_record/connection_adapters/type/value.rb +++ b/activerecord/lib/active_record/connection_adapters/type/value.rb @@ -8,6 +8,18 @@ module ActiveRecord cast_value(value) unless value.nil? end + def text? + false + end + + def number? + false + end + + def binary? + false + end + private def cast_value(value) |