diff --git a/lib/ruby_lsp/ruby_lsp_rails/server.rb b/lib/ruby_lsp/ruby_lsp_rails/server.rb index f8a5308f..e48787db 100644 --- a/lib/ruby_lsp/ruby_lsp_rails/server.rb +++ b/lib/ruby_lsp/ruby_lsp_rails/server.rb @@ -146,8 +146,10 @@ def resolve_route_info(requirements) ::Rails.application.routes.routes.find { |route| route.requirements == requirements } end - if route&.source_location - file, _, line = route.source_location.rpartition(":") + source_location = route&.respond_to?(:source_location) && route.source_location + + if source_location + file, _, line = source_location.rpartition(":") body = { source_location: [::Rails.root.join(file).to_s, line], verb: route.verb,