aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/type/unsigned_integer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/type/unsigned_integer.rb')
-rw-r--r--activemodel/lib/active_model/type/unsigned_integer.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/type/unsigned_integer.rb b/activemodel/lib/active_model/type/unsigned_integer.rb
new file mode 100644
index 0000000000..3f49f9f5f7
--- /dev/null
+++ b/activemodel/lib/active_model/type/unsigned_integer.rb
@@ -0,0 +1,15 @@
+module ActiveModel
+ module Type
+ class UnsignedInteger < Integer # :nodoc:
+ private
+
+ def max_value
+ super * 2
+ end
+
+ def min_value
+ 0
+ end
+ end
+ end
+end