prefixed_ids 1.9.1 → 1.9.2
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/lib/prefixed_ids/version.rb +1 -1
- data/lib/prefixed_ids.rb +5 -9
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f4a7dba39c3feff4c04155095501305cda1f83649a3084587276762bba4bf43
|
|
4
|
+
data.tar.gz: 94f8821fbe8f4b6144d9f1d88fad5c86d91f6b92c69718d5584214724d07d89e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 800ac6f9df59cfe8d75a9606e66ee926f0d03eff86360d3ff23b1f1286a4746ca04d865e89ac2fabd377d0632310abbcfc7b37980ef2b595d0eb8e6f14ef0a3d
|
|
7
|
+
data.tar.gz: 9c90c492213661c063cdbe3510369fee96958fc00845a18cb6c831f3741bdd2a6ee52ebf6b94ceb1d2a55ee9fdd769b0526dddd9e4a8a4af8979604a2cbbd30b
|
data/lib/prefixed_ids/version.rb
CHANGED
data/lib/prefixed_ids.rb
CHANGED
|
@@ -166,13 +166,11 @@ module PrefixedIds
|
|
|
166
166
|
super.tap { |r| r.extend ClassMethods }
|
|
167
167
|
end
|
|
168
168
|
|
|
169
|
-
def belongs_to(*args, **options, &block)
|
|
170
|
-
|
|
169
|
+
def belongs_to(name, *args, **options, &block)
|
|
170
|
+
super
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
return association if reflection.polymorphic?
|
|
172
|
+
reflection = reflect_on_association(name)
|
|
173
|
+
return if reflection.polymorphic?
|
|
176
174
|
|
|
177
175
|
# Skip helpers if the associated class can't be loaded yet, so Rails only raises when the association is used
|
|
178
176
|
klass = begin
|
|
@@ -180,7 +178,7 @@ module PrefixedIds
|
|
|
180
178
|
rescue NameError
|
|
181
179
|
nil
|
|
182
180
|
end
|
|
183
|
-
return
|
|
181
|
+
return if klass.nil? || klass._prefix_id.blank?
|
|
184
182
|
|
|
185
183
|
generated_association_methods.class_eval <<-CODE, __FILE__, __LINE__ + 1
|
|
186
184
|
def #{name}_prefix_id
|
|
@@ -192,8 +190,6 @@ module PrefixedIds
|
|
|
192
190
|
send("#{reflection.foreign_key}=", decoded_id)
|
|
193
191
|
end
|
|
194
192
|
CODE
|
|
195
|
-
|
|
196
|
-
association
|
|
197
193
|
end
|
|
198
194
|
|
|
199
195
|
def has_many(*args, &block)
|