aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/type/string.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-05-20 16:39:25 +0200
committerYves Senn <yves.senn@gmail.com>2014-05-20 16:39:25 +0200
commitd17b05657153f4305e4112532c485239d49b77b8 (patch)
tree89890683aa8ec5f81298415b60cc890c958b2da2 /activerecord/lib/active_record/connection_adapters/type/string.rb
parentf9860fcbe2973025df6ccf4bba0431492af09575 (diff)
parent36fde2b704164ac02380518350f01a17d3e0208e (diff)
downloadrails-d17b05657153f4305e4112532c485239d49b77b8.tar.gz
rails-d17b05657153f4305e4112532c485239d49b77b8.tar.bz2
rails-d17b05657153f4305e4112532c485239d49b77b8.zip
Merge pull request #15197 from sgrif/sg-delegate-type-cast-sqlite3
Delegate `#type_cast` to injected type objects on SQLite3
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/type/string.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/type/string.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/type/string.rb b/activerecord/lib/active_record/connection_adapters/type/string.rb
index 0feb4299f5..d6c1c64834 100644
--- a/activerecord/lib/active_record/connection_adapters/type/string.rb
+++ b/activerecord/lib/active_record/connection_adapters/type/string.rb
@@ -5,6 +5,16 @@ module ActiveRecord
def type
:string
end
+
+ private
+
+ def cast_value(value)
+ case value
+ when true then "1"
+ when false then "0"
+ else value.to_s
+ end
+ end
end
end
end