diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-06-28 23:33:31 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-28 23:33:31 -0300 |
commit | a215642828bba664e39e8238c34a8367e30ac530 (patch) | |
tree | f695e0108d5764c7d9c543184a7644c52a7dae2d /activemodel/lib | |
parent | af874cc57fd32e7d37beebe1a82072594504057e (diff) | |
parent | 10b81fb51acc600926613e9ea78125635950a1f0 (diff) | |
download | rails-a215642828bba664e39e8238c34a8367e30ac530.tar.gz rails-a215642828bba664e39e8238c34a8367e30ac530.tar.bz2 rails-a215642828bba664e39e8238c34a8367e30ac530.zip |
Merge pull request #25364 from kamipo/fix_serialize_for_date_type
Fix `Type::Date#serialize` to return a date object correctly
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/type/date.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/type/date.rb b/activemodel/lib/active_model/type/date.rb index f74243a22c..edd07ac38c 100644 --- a/activemodel/lib/active_model/type/date.rb +++ b/activemodel/lib/active_model/type/date.rb @@ -7,6 +7,10 @@ module ActiveModel :date end + def serialize(value) + cast(value) + end + def type_cast_for_schema(value) "'#{value.to_s(:db)}'" end |