aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/type/date.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-05-30 14:22:17 +0200
committerYves Senn <yves.senn@gmail.com>2014-05-30 14:22:17 +0200
commit4321cd09a5b81fee278e39564d4729784732611c (patch)
treee1b968ed5c084d0edc6eed0c755ca53aaefe9f90 /activerecord/lib/active_record/type/date.rb
parentb9eeb0339df7bd746273d680a26258df78dbd262 (diff)
downloadrails-4321cd09a5b81fee278e39564d4729784732611c.tar.gz
rails-4321cd09a5b81fee278e39564d4729784732611c.tar.bz2
rails-4321cd09a5b81fee278e39564d4729784732611c.zip
refactor, introduce `Type#type_cast_for_schema` to cast for schema.rb
This removes the case statement in `SchemaDumper` and gives every `Type` the possibility to control the SchemaDumper default value output. /cc @sgrif
Diffstat (limited to 'activerecord/lib/active_record/type/date.rb')
-rw-r--r--activerecord/lib/active_record/type/date.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/type/date.rb b/activerecord/lib/active_record/type/date.rb
index 45c69460ef..d90a6069b7 100644
--- a/activerecord/lib/active_record/type/date.rb
+++ b/activerecord/lib/active_record/type/date.rb
@@ -9,6 +9,10 @@ module ActiveRecord
::Date
end
+ def type_cast_for_schema(value)
+ "'#{value.to_s(:db)}'"
+ end
+
private
def cast_value(value)