class RubyLsp::Rails::Definition
The definition request jumps to the definition of the symbol under the cursor.
Currently supported targets:
-
Callbacks
-
Named routes (e.g.
users_path
)
Example¶ ↑
before_action :foo # <- Go to definition on this symbol will jump to the method if it is defined in the same class
Notes for named routes:
-
It is available only in
Rails
7.1 or newer. -
Route may be defined across multiple files, e.g. using
draw
, rather than inroutes.rb
. -
Routes won’t be found if not defined for the
Rails
development environment. -
If using
constraints
, the route can only be found if the constraints are met. -
Changes to routes won’t be picked up until the server is restarted.