mongoid-collection-separated 0.2.1 → 0.2.2

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
  SHA256:
3
- metadata.gz: 1501b3fd24ed9ff90171172b7326fad51df02c43a5807eb6d2c0ccc95478b3f9
4
- data.tar.gz: 565722648220c06df4d8b5ee113e11ef755dd28da41ee0b0ec63101224831eaa
3
+ metadata.gz: bbcfb28aa8720aca9c5cd1d2a1cd367edddf58be667c38c8c6339f3394f7bf31
4
+ data.tar.gz: 9b8e39fe7734198249b60e3c87d6eb8926b799d1b73f1fd785d3f1c18a1478d4
5
5
  SHA512:
6
- metadata.gz: f32b9c5f70785ec2dd5e77113c26f9bb171f1da31807c29e4a2d379582381da553afc1c42c7079e0e131d4ff8d10ac147e9efe91f7a8eddf9a071133d7c609ce
7
- data.tar.gz: 569bf34bec6475fd847b120d36fd5f3990d2c0c194253f479f97bd12585f0c737f7e00c2f5fbb0d3996c7306e80e009f40898dc8d8eea8cb3e7fef981f9fbead
6
+ metadata.gz: 0f092742e2e26f1227d38e8a1d69a48bfdfde543da5e0081f167528bdd700747233aafe7d28b7274fad6f2830030e4cc249ce60740ecf66d49810f39ea63a08a
7
+ data.tar.gz: 135fe9df6a833390a2fb14d0c6e1f10d21f75e107f320a0bef156e8bd8fecab51f15a68be64e56d4c1e705ff868fa7edc730b4196e0aa5673a900b7a5ca65b24
@@ -1,6 +1,6 @@
1
1
  module Mongoid
2
2
  module CollectionSeparated
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
6
6
 
@@ -8,36 +8,14 @@ module Mongoid
8
8
  module CollectionSeparated
9
9
  extend ActiveSupport::Concern
10
10
 
11
- included do
12
- action_method_module = [Mongoid::Persistable.constants.map {|c| Mongoid::Persistable.const_get(c)} + [Mongoid::Reloadable]].flatten.select {|c| c.is_a?(Module)}
13
- action_method_module.each {|action_module| alias_method_with_collection action_module}
14
- end
15
-
16
11
  class_methods do
17
12
  attr_accessor :separated_field, :separated_parent_class, :separated_parent_field, :calc_collection_name_fun
18
-
19
13
  def separated_by separated_field, calc_collection_name_fun, opts={}
20
14
  @separated_parent_class = opts[:parent_class].constantize
21
15
  @separated_parent_field = opts[:parent_field] || :id
22
16
  @separated_field = separated_field
23
17
  @calc_collection_name_fun = calc_collection_name_fun
24
18
  end
25
-
26
- def alias_method_with_collection action_module
27
- action_module.instance_methods(false).each do |action_method|
28
- define_method "#{action_method}_with_context" do |*args|
29
- klass = self.class
30
- self.send "#{action_method}_without_context", *args unless klass.respond_to?(:separated_field)
31
-
32
- collection_name = klass.where(klass.separated_field => self.send(klass.separated_field)).ensured_collection.name
33
- self.with(collection: collection_name) {self.send "#{action_method}_without_context", *args}
34
- end
35
-
36
- alias_method "#{action_method}_without_context".to_sym, action_method
37
- alias_method action_method.to_sym, "#{action_method}_with_context".to_sym
38
- end
39
- end
40
-
41
19
  end
42
20
 
43
21
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  end
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_dependency 'mongoid', ' ~> 6.4'
23
+ spec.add_dependency 'mongoid', ' ~> 6.2'
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 1.17"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-collection-separated
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - aibotyu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-05 00:00:00.000000000 Z
11
+ date: 2019-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '6.4'
19
+ version: '6.2'
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: '6.4'
26
+ version: '6.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -120,7 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  requirements: []
123
- rubygems_version: 3.0.1
123
+ rubyforge_project:
124
+ rubygems_version: 2.7.8
124
125
  signing_key:
125
126
  specification_version: 4
126
127
  summary: Save the mongoid model into different collections by condition