I love Rails.vim but I have a problem with using it in some projects. I have two places for controllers in one of my apps:
app/controllers
app/controllers/v1/api
Can I configure (perhaps in config/rails.vim?) this extra path somehow? I'd like to use both of them.
I can navigate by hand like this:
:Rcontroller v1/api/messages_controller.rb
but :Rmodel from this controller does not work, it tries to jump to models/v1/api/model.rb
This isn't tied into the rails.vim add-on, but you can add an additional command to do this for you. I believe this would be far easier than trying to modify the rails.vim source.
I actually wrote a blog post about something similar. For your purposes, you'd want to put something like this in your vimrc:
command -nargs=? RcontrollerApi e \path\to\your\project\app\controllers\v1\api\<args>_controller.rb
You could then call it like this:
:RcontrollerApi messages
You wouldn't have the extra rails.vim sweetness that goes along with the native functionality, though (Like typing :Rcontroller
in a view to automatically go to that file).
Here's an idea that may (or may not) work. I don't believe it will allow you to access the aforementioned functionality but it very well may point you in the right direction.
command -nargs=? RcontrollerApi Rcontroller v1/api/<args>_controller.rb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With