aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/type
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-05-22 10:03:26 -0700
committerSean Griffin <sean@thoughtbot.com>2014-05-22 11:51:59 -0700
commit57cc778fc851c606af4eb5f1dbc979d114637490 (patch)
tree61eddc3f8e5a97b0b677ab9e4c9f14ceb58e3bfa /activerecord/lib/active_record/connection_adapters/type
parent3b814ed2b52305797451149dbb629b601a18165f (diff)
downloadrails-57cc778fc851c606af4eb5f1dbc979d114637490.tar.gz
rails-57cc778fc851c606af4eb5f1dbc979d114637490.tar.bz2
rails-57cc778fc851c606af4eb5f1dbc979d114637490.zip
Push scale to type objects
Ideally types will be usable without having to specify a sql type string, so we should keep the information related to parsing them on the adapter or another object.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/type')
-rw-r--r--activerecord/lib/active_record/connection_adapters/type/decimal.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/type/value.rb9
2 files changed, 7 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/type/decimal.rb b/activerecord/lib/active_record/connection_adapters/type/decimal.rb
index a8cd1cf5b5..ac5af4b963 100644
--- a/activerecord/lib/active_record/connection_adapters/type/decimal.rb
+++ b/activerecord/lib/active_record/connection_adapters/type/decimal.rb
@@ -4,8 +4,6 @@ module ActiveRecord
class Decimal < Value # :nodoc:
include Numeric
- delegate :extract_scale, to: Type
-
def type
:decimal
end
diff --git a/activerecord/lib/active_record/connection_adapters/type/value.rb b/activerecord/lib/active_record/connection_adapters/type/value.rb
index 6687c9a2a4..b37c3bad58 100644
--- a/activerecord/lib/active_record/connection_adapters/type/value.rb
+++ b/activerecord/lib/active_record/connection_adapters/type/value.rb
@@ -2,9 +2,14 @@ module ActiveRecord
module ConnectionAdapters
module Type
class Value # :nodoc:
- def type; end
+ attr_reader :scale
+
+ def initialize(options = {})
+ options.assert_valid_keys(:scale)
+ @scale = options[:scale]
+ end
- def extract_scale(sql_type); end
+ def type; end
def extract_precision(sql_type); end