asok / projectile-rails

Emacs Rails mode based on projectile
258 stars 59 forks source link

Jump to related file #108

Closed cmrichards closed 7 years ago

cmrichards commented 7 years ago

Hey, great library btw.

It would be good if there was a "jump-to-related-file" command like there is in the ruby on rails plugin in vim that I use. It's a really conveniant way to navigate around a rails project without needing to remember specific commands for jumping to specific file types (view/controllers/schema).

For example, if you're in a view and perform a "jump-to-related-file" then it will jump to the controller in the related action. And vice versa: If you're in a controller action and "jump-to-related-file" then it will jump to the related view.

Also, but which is less useful, if you're in a model file and perform a "jump-to-related-file" then it would jump to the schema file at the point where the table is defined.

I'm completely new to emacs/spacemacs and only started using it yesterday, so I can't really be of any more help right now.

Thanks!

asok commented 7 years ago

Hey, great library btw.

Thanks.

It's a really conveniant way to navigate around a rails project without needing to remember specific commands for jumping to specific file types (view/controllers/schema).

For example, if you're in a view and perform a "jump-to-related-file" then it will jump to the controller in the related action. And vice versa: If you're in a controller action and "jump-to-related-file" then it will jump to the related view.

There is family of commands projectile-rails-find-current-*. So if you are in a controller and run projectile-rails-find-current-model it will find a model for the controller. It's not smart so for example calling projectile-rails-find-current-view from a controller will present you a list of related templates but it will not try to guess template based on where the point is. There's a room for improvement here.

Also, but which is less useful, if you're in a model file and perform a "jump-to-related-file" then it would jump to the schema file at the point where the table is defined.

Interesting, does vim plugin supports that? Does it also considers self.table_name = "different_name" call in a model?

I'm completely new to emacs/spacemacs and only started using it yesterday, so I can't really be of any more help right now.

Welcome on board.