shrine-mongoid 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb9eace795910cfeb6f228ed000a2179b9099c6f
4
- data.tar.gz: a276da5a7410745fedc9e357a3c3614863b1dbff
3
+ metadata.gz: e2b1e8d99cc0c91b6d0803af1c5a43127937b515
4
+ data.tar.gz: b1ff874fa3e96079fc196082a246825cdbaa25c1
5
5
  SHA512:
6
- metadata.gz: 5357e2df11cf21318d440c1470743b4b8bb3d534c7e2878825265149bc6a1c158dd74780a12d75d006682b2b6013eccd756f164544bf42012c29d39de77d0b5a
7
- data.tar.gz: 38eb05b9b1fbb2d2ef29e9414f94a024d8f092e7baec1ccc9ac61cab88cfd590246f95facb606f474e96c724d9e773a91b4c072f41124db9b7ed9c7ba297884c
6
+ metadata.gz: 75a577a6573eb7af7f8844de8f2b70b6789fa714614c0648bc33ded56a60ee8b23f93c944005ec82a13e5bdbb62972058697706351037b6efd08930e568ea4a0
7
+ data.tar.gz: 2f4da99a99ceae93fd5d75e92e18a0542c9cfe03bacae81645b09bae8e9844ff6bcf8602de069944adff6088d20ab3ca510b99bbe64cbeb91ea0ba6c981629d2
@@ -57,6 +57,17 @@ class Shrine
57
57
  super
58
58
  record.save!
59
59
  end
60
+
61
+ def convert_before_write(value)
62
+ mongoid_hash_field? ? value : super
63
+ end
64
+
65
+ def mongoid_hash_field?
66
+ return false unless record.is_a?(::Mongoid::Document)
67
+ return false unless field = record.class.fields[data_attribute.to_s]
68
+
69
+ field.type == Hash
70
+ end
60
71
  end
61
72
  end
62
73
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "shrine-mongoid"
3
- gem.version = "0.2.3"
3
+ gem.version = "0.2.4"
4
4
 
5
5
  gem.required_ruby_version = ">= 2.1"
6
6
 
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.files = Dir["README.md", "LICENSE.txt", "lib/**/*.rb", "*.gemspec"]
14
14
  gem.require_path = "lib"
15
15
 
16
- gem.add_dependency "shrine", "~> 2.3"
16
+ gem.add_dependency "shrine", "~> 2.4"
17
17
  gem.add_dependency "mongoid", ">= 5.0"
18
18
 
19
19
  gem.add_development_dependency "shrine-memory"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shrine-mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-29 00:00:00.000000000 Z
11
+ date: 2016-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shrine
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.3'
19
+ version: '2.4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.3'
26
+ version: '2.4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mongoid
29
29
  requirement: !ruby/object:Gem::Requirement