Commit 518a2fae authored by Mehmet Emin INAC's avatar Mehmet Emin INAC

Fix the problem on CreateTableWithForeignKeys cop

parent a643dbda
...@@ -35,7 +35,7 @@ module RuboCop ...@@ -35,7 +35,7 @@ module RuboCop
) )
PATTERN PATTERN
def_node_search :argument_name, <<~PATTERN def_node_matcher :argument_name?, <<~PATTERN
{(sym $...) (str $...)} {(sym $...) (str $...)}
PATTERN PATTERN
...@@ -87,7 +87,11 @@ module RuboCop ...@@ -87,7 +87,11 @@ module RuboCop
end end
def arguments_to_table_names(arguments) def arguments_to_table_names(arguments)
arguments.flat_map { |argument| argument_name(argument).to_a.flatten.first.to_s.pluralize.to_sym } arguments.select { |argument| argument_name?(argument) }
.map(&:value)
.map(&:to_s)
.map(&:pluralize)
.map(&:to_sym)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment