acts_as_has_many 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/acts_as_has_many/version.rb +1 -1
- data/lib/acts_as_has_many.rb +9 -3
- metadata +2 -4
- data/Gemfile.lock +0 -38
- data/acts_as_has_many-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89714b7c2bb72bd9cf5a8b95895bcbd48feb8f0e426fb7c01ff0edfb8552eeb1
|
4
|
+
data.tar.gz: 53f475bb074fddb43bec43ce74bf34951bed0c0b641dd4ac489e44aa6dacfcc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5a13ec57af88119d65819c5a7bead2ef862e9e28a73ecbb33f3fb53df0e3276894a49a2d6427af6547820b8352688b1645963a147e2405bf8e02670d15f6124
|
7
|
+
data.tar.gz: 822404ab0b79e862b1af93baa6eb6aed72db402b0a0c5ecd223826328181b6158301e0ac0b8f6007dbb78d67e4a5d31e2ae70d202219b8bf2e0be1b7a04fdaf8
|
data/lib/acts_as_has_many.rb
CHANGED
@@ -14,18 +14,24 @@ module ActsAsHasMany
|
|
14
14
|
column = options[:attribute].presence || attribute
|
15
15
|
klass = options[:class_name].presence || attribute.classify
|
16
16
|
|
17
|
-
define_method(attribute) do
|
17
|
+
define_method(attribute.to_sym) do
|
18
18
|
@options ||= read_attribute(column).map do |option|
|
19
19
|
klass.constantize.new(option)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
define_method("#{attribute}=".to_sym) do |value|
|
24
|
-
write_attribute(
|
24
|
+
write_attribute(column, value.as_json)
|
25
25
|
end
|
26
|
+
end
|
26
27
|
|
28
|
+
def acts_as_accepts_nested_attributes_for(attribute, options = {})
|
27
29
|
define_method("#{attribute}_attributes=".to_sym) do |associates|
|
28
|
-
|
30
|
+
writeable_associates = associates.values.filter_map do |associate|
|
31
|
+
associate.except('_destroy') unless associate['_destroy'].present?
|
32
|
+
end
|
33
|
+
|
34
|
+
public_send("#{attribute}=".to_sym, writeable_associates)
|
29
35
|
end
|
30
36
|
end
|
31
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_has_many
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pralish Kayastha
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -36,11 +36,9 @@ files:
|
|
36
36
|
- CHANGELOG.md
|
37
37
|
- CODE_OF_CONDUCT.md
|
38
38
|
- Gemfile
|
39
|
-
- Gemfile.lock
|
40
39
|
- LICENSE.txt
|
41
40
|
- README.md
|
42
41
|
- Rakefile
|
43
|
-
- acts_as_has_many-0.1.0.gem
|
44
42
|
- lib/acts_as_has_many.rb
|
45
43
|
- lib/acts_as_has_many/version.rb
|
46
44
|
- sig/acts_as_has_many.rbs
|
data/Gemfile.lock
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
acts_as_has_many (0.1.0)
|
5
|
-
activerecord (>= 3.0.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
activemodel (6.1.7.6)
|
11
|
-
activesupport (= 6.1.7.6)
|
12
|
-
activerecord (6.1.7.6)
|
13
|
-
activemodel (= 6.1.7.6)
|
14
|
-
activesupport (= 6.1.7.6)
|
15
|
-
activesupport (6.1.7.6)
|
16
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
-
i18n (>= 1.6, < 2)
|
18
|
-
minitest (>= 5.1)
|
19
|
-
tzinfo (~> 2.0)
|
20
|
-
zeitwerk (~> 2.3)
|
21
|
-
concurrent-ruby (1.2.2)
|
22
|
-
i18n (1.14.1)
|
23
|
-
concurrent-ruby (~> 1.0)
|
24
|
-
minitest (5.20.0)
|
25
|
-
rake (13.0.6)
|
26
|
-
tzinfo (2.0.6)
|
27
|
-
concurrent-ruby (~> 1.0)
|
28
|
-
zeitwerk (2.6.12)
|
29
|
-
|
30
|
-
PLATFORMS
|
31
|
-
arm64-darwin-22
|
32
|
-
|
33
|
-
DEPENDENCIES
|
34
|
-
acts_as_has_many!
|
35
|
-
rake (~> 13.0)
|
36
|
-
|
37
|
-
BUNDLED WITH
|
38
|
-
2.3.26
|
data/acts_as_has_many-0.1.0.gem
DELETED
Binary file
|