lib/rubocop/cop/rails/add_column_index.rb in rubocop-rails-2.18.0 vs lib/rubocop/cop/rails/add_column_index.rb in rubocop-rails-2.19.0
- old
+ new
@@ -40,21 +40,21 @@
add_index = "add_index #{table.source}, #{column.source}"
add_index_opts = ''
if value.hash_type?
- hash = value.loc.expression.adjust(begin_pos: 1, end_pos: -1).source.strip
+ hash = value.source_range.adjust(begin_pos: 1, end_pos: -1).source.strip
add_index_opts = ", #{hash}"
end
corrector.insert_after(node, "\n#{add_index}#{add_index_opts}")
end
end
private
def index_range(pair_node)
- range_with_surrounding_comma(range_with_surrounding_space(pair_node.loc.expression, side: :left), :left)
+ range_with_surrounding_comma(range_with_surrounding_space(pair_node.source_range, side: :left), :left)
end
end
end
end
end