momocop 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 583e60d7747c3d18b2e39a5fe6d2f4cb4a02d9484ee21d49c3b6e06381c7db1a
|
4
|
+
data.tar.gz: 72139ae77375a441a56925c906be69d34993c867a3a23337dde3f7e47e257b31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0fb80f1fa23509e2ace6883efd371d3aeffac8f8472f484b8e797ba2ce1347518e2b124da72116fffe86ad82610a1d7e9af557da0cc04666bc214e4228d7248
|
7
|
+
data.tar.gz: 125d23305c4a085e35a0f3785f5b5f3f6cb00c4cfbeb44063e838ea5138b755e3d8b183a813c2776ddd56bf566cf682081bde359fc4e5c713d28459494b124e1
|
data/lib/momocop/version.rb
CHANGED
@@ -126,12 +126,15 @@ module RuboCop
|
|
126
126
|
associations = extractor.extract(source)
|
127
127
|
foreign_key_names =
|
128
128
|
associations
|
129
|
+
.select { _1[:type] == :belongs_to }
|
129
130
|
.map { |association|
|
130
131
|
options = association[:options]
|
131
132
|
if options[:foreign_key]
|
132
133
|
options[:foreign_key]
|
133
134
|
elsif options[:class_name]
|
134
135
|
foreign_key_name(options[:class_name])
|
136
|
+
else
|
137
|
+
"#{association[:name]}_id"
|
135
138
|
end
|
136
139
|
}
|
137
140
|
.compact
|