Command+click on class names in Rails helper methods
Is there a way to make class names in Rails helper methods “command clickable” (i.e. open their definition in the stylesheet), like class names in html elements are? For example, when clicking on main-nav__link
in this helper, RubyMine “cannot find declaration to go to”:
<%= link_to current_user.name, user_path(current_user), class: "main-nav__link" %>
Please sign in to leave a comment.
Hello,
Could you please specify where in this case you'd expect the navigation to go?
Olga Kuvardina Sure - I'd expect it to go to the class definition in the stylesheets, the same way clicking a class name in standard html does now:
burma I was trying to reproduce it, but in my case that navigation doesn't work for standard html as well. Would it be possible to share a project sample for reproduce?
Olga Kuvardina I've attached a screenshot that shows normal behavior in an .erb file (the default Ruby on Rails template format). Hovering over a class selector (while holding Cmd button on a Mac) will lead to the linked style definition (in this case: .mgr_content__header opens its definition in the mgr.css file, as you can see in the tooltip). This only seems to work when when the class selector is part of an html element (like <h1 class="whatever">). It does not work when the class is part of a Rails helper method, like the example I provided in the first post:
<%= link_to current_user.name, class: “whatever” %>
Any Rails project should suffice for testing this. Let me know if you need more info.
Thank you for the details provided. I've submitted the corresponding issue on our tracker, so could you please add your vote there.
Thank you Olga Kuvardina !