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: 2f8ebe27766e45fdc287845e8dc4d8015b13b279a34ba58a0b85f3daa0406dd6
4
- data.tar.gz: c991e08f8256f641657868520293b117b694d7177142d8d9e82c226e18f85305
3
+ metadata.gz: 583e60d7747c3d18b2e39a5fe6d2f4cb4a02d9484ee21d49c3b6e06381c7db1a
4
+ data.tar.gz: 72139ae77375a441a56925c906be69d34993c867a3a23337dde3f7e47e257b31
5
5
  SHA512:
6
- metadata.gz: d44b953c25c50ca2da56043dceb78b41db565f5226d84bf091ca1cc32bb886d08b93791751c511bc37eda7d1f509b27645f1ce4202e7c5e7b47656f53e963995
7
- data.tar.gz: '0348eb2e208e147158a837934efadeb796bbc0d4169a2c9dfb050eba282488ea6c28e96ed57d2deae4dd6202a996487162ecaad06a94faa537693b7b49edf49d'
6
+ metadata.gz: e0fb80f1fa23509e2ace6883efd371d3aeffac8f8472f484b8e797ba2ce1347518e2b124da72116fffe86ad82610a1d7e9af557da0cc04666bc214e4228d7248
7
+ data.tar.gz: 125d23305c4a085e35a0f3785f5b5f3f6cb00c4cfbeb44063e838ea5138b755e3d8b183a813c2776ddd56bf566cf682081bde359fc4e5c713d28459494b124e1
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Momocop
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
5
5
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: momocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - supermomonga