hanami-mongoid 0.1.2 → 0.1.3
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/hanami/mongoid/repository.rb +11 -1
- data/lib/hanami/mongoid/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8aa04811270cc7992c7da3260c0b574090cd44e1b119b936c039290264fcd245
|
4
|
+
data.tar.gz: 8588ab96c57fd373424b8565c6febc905ca5eff76fb882d91d97fc72539fb817
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68abc67ec639d3cf1e288d0d408be1c35ac02ec4905b922c423dfcc2588a305fcf517d710280eedfda3cc4879a6839545907106c2242cbd2c865f99d5a6f4b05
|
7
|
+
data.tar.gz: d5e8c9de62519c80985ba46de6bf629316022a2e626b8a3d46dd4075046f9b6d6b314872be847032ab38955490de59908022b1d98cd57d34811ce3be6626f7c6
|
data/Gemfile.lock
CHANGED
@@ -12,13 +12,23 @@ module Hanami
|
|
12
12
|
|
13
13
|
##
|
14
14
|
# Forwards common repository methods to the model
|
15
|
-
%i( find find_by where any_of all first last
|
15
|
+
%i( find find_by where any_of all first last
|
16
16
|
destroy_all delete_all update_all ).each do |method|
|
17
17
|
define_method method do |*args|
|
18
18
|
self.model_klass.send method, *args
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
##
|
23
|
+
# Forwards create method to accept a model instance
|
24
|
+
define_method :create do |model_instance|
|
25
|
+
if model_instance.is_a? self.model_klass
|
26
|
+
model_instance.save
|
27
|
+
else
|
28
|
+
self.model_klass.create(model_instance)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
##
|
23
33
|
# Forwards common repository methods to the model instance
|
24
34
|
%i( destroy delete update_attributes update ).each do |method|
|