rubydb-activerecord 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: becb1537aee9af710911f9a816a27b272dc5bde4889dbed351c1131ba9184224
4
- data.tar.gz: dc0e6243c319dbaaa738a0470032655f772fa98339de1af8f24066b66e321e3e
3
+ metadata.gz: 58409e5dd807a01080f4c273c80f4717774268f5eb718ee91967c4133edf8d2a
4
+ data.tar.gz: cf9e28b8e875e503a569b24b16621f7598ed0b06a9bcc184b7c7ceee52282b6a
5
5
  SHA512:
6
- metadata.gz: 72aeae225241636cfa38e01553fa35a79a0d411330ef1bd894d8bbf88f5497e900e71924db4f7cf5b7bb797ab974e4d07f316cea6b3d56255a75314aaafe6db3
7
- data.tar.gz: e09c7ce51be379034426dc82f7047b74a954b8979d6c716f37cca70d6add2669158f9f552b688adad67aa501959fa54c2a89d4e1b28dafaca3bd50b58dbb971f
6
+ metadata.gz: d5f0d247b93310e35e2683473d3b6a177152698acfeefdfc73f5fd2844398b54e67c61b40bd5ac6fc8a2e767e814335f858c9e89c30fb07ab20c6176227c7576
7
+ data.tar.gz: 5adc967daaace477a103298d1d9c8864beb05c33fe87e218a1d2fac67b8af38db780515b5dfda1e1b0a88263591978d25a37bba7c4ab84cf212d32b391345574
@@ -756,10 +756,15 @@ module ActiveRecord
756
756
 
757
757
  # ActiveRecord's generic Column deduplication is string-oriented. RubyDB
758
758
  # persists typed defaults, so serialize scalar defaults at this boundary
759
- # and let ActiveRecord cast them through the column type map.
760
- def rails_default_value(value)
761
- value.is_a?(String) ? value : value.to_s
762
- end
759
+ # and let ActiveRecord cast them through the column type map.
760
+ def rails_default_value(value)
761
+ # RubyDB exposes SQL defaults as AST literals. ActiveRecord expects
762
+ # the scalar payload when it builds its Column metadata; calling
763
+ # `to_s` on the wrapper would leak the Ruby object inspection into
764
+ # newly instantiated records.
765
+ value = value.value if value.respond_to?(:value) && !value.is_a?(String)
766
+ value.is_a?(String) ? value : value.to_s
767
+ end
763
768
 
764
769
  def sql_for_execution(sql)
765
770
  sql = sql.to_sql if sql.respond_to?(:to_sql)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "rubydb-activerecord"
5
- spec.version = "0.1.0"
5
+ spec.version = "0.1.1"
6
6
  spec.authors = ["Aldane Hutchinson"]
7
7
  spec.email = ["aldanehutchinson5@gmail.com"]
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubydb-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aldane Hutchinson