attr_json-associations 0.2.0 → 0.2.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 +4 -4
- data/.github/workflows/ci.yml +2 -2
- data/CHANGELOG.md +4 -0
- data/gemfiles/rails70.gemfile +4 -0
- data/gemfiles/rails81.gemfile +2 -0
- data/lib/attr_json/associations/definer.rb +14 -2
- data/lib/attr_json/associations/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 364001e04ab5257a1a38332493abf5e8f96bbe9dc6166efdc74634ff829ba4ef
|
|
4
|
+
data.tar.gz: c71e6c55e9a895405e11a780bfa9697ecccdee983670354f0230c1091039189a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3219055ded80bb5305ca782362bf28e9a3a1173fe620649b52b0d6644162fcca69692505e4a7fc93852765cf163fb5f1193d051f15fd58c8aa14b4a8658c12b1
|
|
7
|
+
data.tar.gz: 73723a32e72aa366d24d5a4fa6b294180449c5f564c65620f612194c172305482298cafa4148ecabff85260192cda1fb19092b70adb0a91c519546f93e52bb5a
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -4,7 +4,7 @@ on: [push, pull_request]
|
|
|
4
4
|
|
|
5
5
|
jobs:
|
|
6
6
|
test:
|
|
7
|
-
runs-on: ubuntu-
|
|
7
|
+
runs-on: ubuntu-24.04
|
|
8
8
|
services:
|
|
9
9
|
postgres:
|
|
10
10
|
image: postgres:15
|
|
@@ -77,7 +77,7 @@ jobs:
|
|
|
77
77
|
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
|
78
78
|
|
|
79
79
|
steps:
|
|
80
|
-
- uses: actions/checkout@
|
|
80
|
+
- uses: actions/checkout@v7
|
|
81
81
|
- uses: ruby/setup-ruby@v1
|
|
82
82
|
with:
|
|
83
83
|
ruby-version: ${{ matrix.ruby }}
|
data/CHANGELOG.md
CHANGED
data/gemfiles/rails70.gemfile
CHANGED
data/gemfiles/rails81.gemfile
CHANGED
|
@@ -17,7 +17,7 @@ module AttrJson::Associations
|
|
|
17
17
|
|
|
18
18
|
def call
|
|
19
19
|
@klass.attr_json_associations = @klass.attr_json_associations.merge(@assoc.name => @assoc)
|
|
20
|
-
|
|
20
|
+
generated_association_methods.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
21
21
|
def #{@assoc.name}
|
|
22
22
|
assoc = self.class.attr_json_associations[:#{@assoc.name}]
|
|
23
23
|
@attr_json_associations_cache[:#{@assoc.name}] ||=
|
|
@@ -26,7 +26,7 @@ module AttrJson::Associations
|
|
|
26
26
|
RUBY
|
|
27
27
|
|
|
28
28
|
if @assoc.is_a?(AttrJson::Associations::Association::BelongsTo)
|
|
29
|
-
|
|
29
|
+
generated_association_methods.class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
30
30
|
def #{@assoc.foreign_key}=(val)
|
|
31
31
|
super.tap do
|
|
32
32
|
@attr_json_associations_cache[:#{@assoc.name}] = nil
|
|
@@ -35,5 +35,17 @@ module AttrJson::Associations
|
|
|
35
35
|
RUBY
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
|
+
|
|
39
|
+
private
|
|
40
|
+
|
|
41
|
+
def generated_association_methods
|
|
42
|
+
if @klass.const_defined?(:AttrJsonAssociationsMethods, false)
|
|
43
|
+
@klass.const_get(:AttrJsonAssociationsMethods, false)
|
|
44
|
+
else
|
|
45
|
+
@klass.const_set(:AttrJsonAssociationsMethods, Module.new).tap do |mod|
|
|
46
|
+
@klass.prepend mod
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
38
50
|
end
|
|
39
51
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: attr_json-associations
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yoshikazu Kaneta
|
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
148
148
|
- !ruby/object:Gem::Version
|
|
149
149
|
version: '0'
|
|
150
150
|
requirements: []
|
|
151
|
-
rubygems_version:
|
|
151
|
+
rubygems_version: 4.0.10
|
|
152
152
|
specification_version: 4
|
|
153
153
|
summary: An association extension for attr_json
|
|
154
154
|
test_files: []
|