accepts_nested_ids 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 +5 -5
- data/.travis.yml +1 -1
- data/CHANGELOG.md +12 -0
- data/README.md +7 -0
- data/accepts_nested_ids.gemspec +1 -1
- data/lib/accepts_nested_ids.rb +1 -1
- data/lib/accepts_nested_ids/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d46bd5aa6f826717d35c0c85d7250b7483e9d9e6b2db19e528ee2aa4d589dd5e
|
4
|
+
data.tar.gz: e548f69560b40eb4420ad9a7c236a7d2fe76a72d1fd6d791b1c61c0aca06a9ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64b38ffe75735cf1959795f83dba1c3c94741bcf2cd93e2fd0cdcee631a7969f3a09b96888b584c23ac9acefc0b01f5760564e2b4676b1f3818de32ea14ee540
|
7
|
+
data.tar.gz: bcd80ed8f969985f315e2717fa5ee78928616f52503e86fc133dc0121fe504344b722664539904326b4eb2893a3990ed02cb0d815061b36758a570e22453cf18
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 0.2.2 (2021-02-04)
|
2
|
+
|
3
|
+
Ensure this works with Ruby 3.0.0 by adding the #attribute method within any class to extend ActiveRecord in order to create those helper methods.
|
4
|
+
Example:
|
5
|
+
`class Company < ActiveRecord::Base
|
6
|
+
include AcceptsNestedIds
|
7
|
+
has_many :users
|
8
|
+
accepts_nested_ids_for :users
|
9
|
+
attribute :user_ids
|
10
|
+
end`
|
11
|
+
|
12
|
+
|
1
13
|
## 0.2.1 (2016-02-05)
|
2
14
|
|
3
15
|
Ensure empty array of nested associations is loaded, to handle situations where a sub class does not define its own associations and the intersection between base and sub class associations was failing.
|
data/README.md
CHANGED
@@ -17,6 +17,7 @@ class Project < ActiveRecord::Base
|
|
17
17
|
has_many :project_users
|
18
18
|
has_many :users, through: :project_users
|
19
19
|
validates :name, presence: true
|
20
|
+
attribute :user_ids
|
20
21
|
end
|
21
22
|
```
|
22
23
|
|
@@ -79,6 +80,7 @@ class Project < ActiveRecord::Base
|
|
79
80
|
has_many :project_users
|
80
81
|
has_many :users, through: :project_users
|
81
82
|
accepts_nested_ids_for :users
|
83
|
+
attribute :user_ids
|
82
84
|
end
|
83
85
|
|
84
86
|
project.user_ids = [...]
|
@@ -92,6 +94,7 @@ class Project < ActiveRecord::Base
|
|
92
94
|
has_many :project_users
|
93
95
|
has_many :included_users, through: :project_users, source: :user
|
94
96
|
accepts_nested_ids_for included_users: "User"
|
97
|
+
attribute :user_ids
|
95
98
|
end
|
96
99
|
|
97
100
|
project.included_user_ids = [...]
|
@@ -108,6 +111,7 @@ class Project < ActiveRecord::Base
|
|
108
111
|
has_many :project_users
|
109
112
|
has_many :included_users, through: :project_users, source: :user
|
110
113
|
accepts_nested_ids_for :documents, included_users: "User"
|
114
|
+
attribute :user_ids
|
111
115
|
end
|
112
116
|
|
113
117
|
project.document_ids = [...]
|
@@ -120,6 +124,9 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
120
124
|
|
121
125
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
122
126
|
|
127
|
+
## Requirements
|
128
|
+
Requires Activemodel & Activerecord `6.1.1` or higher
|
129
|
+
|
123
130
|
## Contributing
|
124
131
|
|
125
132
|
Bug reports and pull requests are welcome on GitHub at https://github.com/uberllama/accepts_nested_ids.
|
data/accepts_nested_ids.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
spec.add_dependency "activesupport", ">= 3.0.0"
|
20
20
|
spec.add_development_dependency "activerecord", ">= 4.2.3"
|
21
|
-
spec.add_development_dependency "bundler", "~>
|
21
|
+
spec.add_development_dependency "bundler", "~> 2.2.7"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
23
|
spec.add_development_dependency "rspec"
|
24
24
|
spec.add_development_dependency "sqlite3"
|
data/lib/accepts_nested_ids.rb
CHANGED
@@ -77,7 +77,7 @@ module AcceptsNestedIds
|
|
77
77
|
define_method("#{nested_id_association.ids_attr}=") do |value|
|
78
78
|
return if send(nested_id_association.ids_attr) == value
|
79
79
|
attribute_will_change!(nested_id_association.ids_attr)
|
80
|
-
instance_variable_set("@#{nested_id_association.ids_attr}", value)
|
80
|
+
instance_variable_set(:"@#{nested_id_association.ids_attr}", value)
|
81
81
|
end
|
82
82
|
|
83
83
|
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.2.
|
4
|
+
version: 0.2.2
|
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:
|
12
|
+
date: 2021-02-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: 2.2.7
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: 2.2.7
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,8 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
|
-
|
140
|
-
rubygems_version: 2.4.6
|
139
|
+
rubygems_version: 3.0.8
|
141
140
|
signing_key:
|
142
141
|
specification_version: 4
|
143
142
|
summary: Predictable nesting of associations via ID
|