Skip to content
This repository
Browse code

Fix related file for controller action

Closes #158.
  • Loading branch information...
commit 04c7b18f66963e3bdb6307052c2dbeb89aad7ead 1 parent 9b3643b
Tim Pope authored

Showing 1 changed file with 4 additions and 5 deletions. Show diff stats Hide diff stats

  1. +4 5 autoload/rails.vim
9 autoload/rails.vim
@@ -3043,12 +3043,11 @@ function! s:readable_related(...) dict abort
3043 3043 if a:0 && a:1
3044 3044 let lastmethod = self.last_method(a:1)
3045 3045 if self.type_name('controller','mailer') && lastmethod != ""
3046   - let root = s:sub(s:sub(s:sub(f,'/application%(_controller)=\.rb$','/shared_controller.rb'),'/%(controllers|models|mailers)/','/views/'),'%(_controller)=\.rb$','/'.lastmethod)
3047   - let format = self.format(a:1)
3048   - if glob(self.app().path().'/'.root.'.'.format.'.*[^~]') != ''
3049   - return root . '.' . format
  3046 + let view = self.resolve_view(lastmethod, line('.'))
  3047 + if view !=# ''
  3048 + return view
3050 3049 else
3051   - return root
  3050 + return s:sub(s:sub(s:sub(f,'/application%(_controller)=\.rb$','/shared_controller.rb'),'/%(controllers|models|mailers)/','/views/'),'%(_controller)=\.rb$','/'.lastmethod)
3052 3051 endif
3053 3052 elseif f =~ '\<config/environments/'
3054 3053 return "config/database.yml#". fnamemodify(f,':t:r')

0 comments on commit 04c7b18

Please sign in to comment.
Something went wrong with that request. Please try again.