aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/type.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2016-08-26 02:07:44 +0900
committerRyuta Kamizono <kamipo@gmail.com>2016-08-26 02:14:06 +0900
commit402852fc6d3222a283b65d407ffec3161946db71 (patch)
tree24424c8f27c12d2ff3a53a602373cafb65969f56 /activerecord/lib/active_record/type.rb
parent804f5b3c2af90b69a51209c56739a077f3fb632b (diff)
downloadrails-402852fc6d3222a283b65d407ffec3161946db71.tar.gz
rails-402852fc6d3222a283b65d407ffec3161946db71.tar.bz2
rails-402852fc6d3222a283b65d407ffec3161946db71.zip
Add `Type.default_value` and use it everywhere for internal
For reduce instantiating `Type::Value`.
Diffstat (limited to 'activerecord/lib/active_record/type.rb')
-rw-r--r--activerecord/lib/active_record/type.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/type.rb b/activerecord/lib/active_record/type.rb
index 1b2fc1b034..0b48d2186a 100644
--- a/activerecord/lib/active_record/type.rb
+++ b/activerecord/lib/active_record/type.rb
@@ -37,6 +37,10 @@ module ActiveRecord
registry.lookup(*args, adapter: adapter, **kwargs)
end
+ def default_value # :nodoc:
+ @default_value ||= Value.new
+ end
+
private
def current_adapter_name