aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/type
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2016-12-08 13:45:47 -0500
committerSean Griffin <sean@seantheprogrammer.com>2016-12-08 13:45:47 -0500
commitef76f83f4cf0f27e84c0c5f4a3ff426d7ad84d9d (patch)
tree673c743609e2c3730706eae5ded47c40c6acf4f0 /activerecord/lib/active_record/type
parent6e948f480118bceb66b72a53874b800fbda05327 (diff)
parent994ce87bbda7cc4b0059c951b06cdd15dc26cb97 (diff)
downloadrails-ef76f83f4cf0f27e84c0c5f4a3ff426d7ad84d9d.tar.gz
rails-ef76f83f4cf0f27e84c0c5f4a3ff426d7ad84d9d.tar.bz2
rails-ef76f83f4cf0f27e84c0c5f4a3ff426d7ad84d9d.zip
Merge pull request #26696 from iainbeeston/only-ruby-types-in-activemodel
Moved database-specific ActiveModel types into ActiveRecord
Diffstat (limited to 'activerecord/lib/active_record/type')
-rw-r--r--activerecord/lib/active_record/type/decimal_without_scale.rb9
-rw-r--r--activerecord/lib/active_record/type/text.rb9
-rw-r--r--activerecord/lib/active_record/type/unsigned_integer.rb15
3 files changed, 33 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/type/decimal_without_scale.rb b/activerecord/lib/active_record/type/decimal_without_scale.rb
new file mode 100644
index 0000000000..7ce33e9cd3
--- /dev/null
+++ b/activerecord/lib/active_record/type/decimal_without_scale.rb
@@ -0,0 +1,9 @@
+module ActiveRecord
+ module Type
+ class DecimalWithoutScale < ActiveModel::Type::BigInteger # :nodoc:
+ def type
+ :decimal
+ end
+ end
+ end
+end
diff --git a/activerecord/lib/active_record/type/text.rb b/activerecord/lib/active_record/type/text.rb
new file mode 100644
index 0000000000..cb1949700a
--- /dev/null
+++ b/activerecord/lib/active_record/type/text.rb
@@ -0,0 +1,9 @@
+module ActiveRecord
+ module Type
+ class Text < ActiveModel::Type::String # :nodoc:
+ def type
+ :text
+ end
+ end
+ end
+end
diff --git a/activerecord/lib/active_record/type/unsigned_integer.rb b/activerecord/lib/active_record/type/unsigned_integer.rb
new file mode 100644
index 0000000000..9ae0109f9f
--- /dev/null
+++ b/activerecord/lib/active_record/type/unsigned_integer.rb
@@ -0,0 +1,15 @@
+module ActiveRecord
+ module Type
+ class UnsignedInteger < ActiveModel::Type::Integer # :nodoc:
+ private
+
+ def max_value
+ super * 2
+ end
+
+ def min_value
+ 0
+ end
+ end
+ end
+end