accepts_nested_ids 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
  SHA1:
3
- metadata.gz: 17cafe27c546d2cba99337b3fe75a190805c048a
4
- data.tar.gz: ccc40cfda5235a83e9ecc0cc036e5a01d809462b
3
+ metadata.gz: 777e9c1455b2e3afe447967dd9bfef1a46e90647
4
+ data.tar.gz: a278c2a289613f95afbf230587b0729cafd21505
5
5
  SHA512:
6
- metadata.gz: fb214073171ad689b195d39c159eed73555ed42080a84726b53863790a6e535a4f8c666605884dc802b76b25a388ea36bda61b01e9d7bb39e35cd311f3cf6ee0
7
- data.tar.gz: c02d8406d6aa4dc8ce0f4e532b9cd9799b66a7c1f5c1556773c31397c9808a089f6fcc2b8ac3c78a4c050d2cdcb4eb5a954e2c7727bbbf959cbed3d8499381c8
6
+ metadata.gz: 23c3f785a49ac7c4e4259fc1b484ffa4293cb403dfc780cacb77778f5c67a47f91c689397980aa28b87acfba20dc507151b64b0019a1a62604f9e6349193ba04
7
+ data.tar.gz: c42cbcf9c416117c52118ae8ca757dfab76b6c3a51e4e8a5d66dc310c9ca5b0fd514e8bd4ec03a9728f7df095faec822b43fc114f5faeab1232af1b6c4d00bc6
@@ -1,4 +1,5 @@
1
1
  require "accepts_nested_ids/version"
2
+ require "accepts_nested_ids/nested_id_association"
2
3
  require "active_support/concern"
3
4
  require "active_support/core_ext/string/inflections"
4
5
 
@@ -34,22 +35,15 @@ module AcceptsNestedIds
34
35
 
35
36
  module ClassMethods
36
37
 
37
- # Simple object that contains information about a nested ID association
38
- #
39
- # @param attr [Symbol] association attribute (ex: :documents)
40
- # @param ids_attr [String] ids association attribute (ex: 'document_ids')
41
- # @param class_name [String] association class name (ex: 'Document')
42
- class NestedIdAssociation < Struct.new(:attr, :ids_attr, :class_name); end
43
-
44
38
  # Sets up defered save and dirty tracking for the specified associations
45
39
  #
46
40
  # @example When class_name can be inferred from association name
47
41
  # include AcceptsNestedIds
48
- # accepts_nested_ids_for :documents, :carrier_companies
42
+ # accepts_nested_ids_for :documents, :users
49
43
  #
50
44
  # @example When class_name is different from association name
51
45
  # include AcceptsNestedIds
52
- # accepts_nested_ids_for :documents, included_carrier_companies: "CarrierCompany"
46
+ # accepts_nested_ids_for :documents, included_users: "User"
53
47
  #
54
48
  # @param args [Array]
55
49
  def accepts_nested_ids_for(*args)
@@ -97,11 +91,11 @@ module AcceptsNestedIds
97
91
  # Map module args into array of NestedIdAssociation objects with supporting properties
98
92
  #
99
93
  # @example
100
- # accepts_nested_ids_for :documents, included_carrier_companies: "CarrierCompany"
94
+ # accepts_nested_ids_for :documents, included_users: "User"
101
95
  # =>
102
96
  # [
103
97
  # { attr: :documents:, ids_attr: "document_ids", class_name: "Document"},
104
- # { attr: :included_carrier_companies, ids_attr: "included_carrier_company_ids", class_name: "CarrierCompany" }
98
+ # { attr: :included_users, ids_attr: "included_user_ids", class_name: "User" }
105
99
  # ]
106
100
  #
107
101
  # @param args [Array]
@@ -0,0 +1,11 @@
1
+ module AcceptsNestedIds
2
+
3
+ # Simple object that contains information about a nested ID association
4
+ #
5
+ # @param attr [Symbol] association attribute (ex: :documents)
6
+ # @param ids_attr [String] ids association attribute (ex: 'document_ids')
7
+ # @param class_name [String] association class name (ex: 'Document')
8
+ class NestedIdAssociation < Struct.new(:attr, :ids_attr, :class_name)
9
+ end
10
+
11
+ end
@@ -1,3 +1,3 @@
1
1
  module AcceptsNestedIds
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: accepts_nested_ids
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
  - Yuval Kordov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-07-26 00:00:00.000000000 Z
12
+ date: 2015-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -114,6 +114,7 @@ files:
114
114
  - bin/console
115
115
  - bin/setup
116
116
  - lib/accepts_nested_ids.rb
117
+ - lib/accepts_nested_ids/nested_id_association.rb
117
118
  - lib/accepts_nested_ids/version.rb
118
119
  homepage: http://github.com/uberllama/accepts_nested_ids
119
120
  licenses: