Skip to content

Commit

Permalink
Fix related file for controller action
Browse files Browse the repository at this point in the history
Closes #158.
  • Loading branch information
tpope committed May 3, 2012
1 parent 9b3643b commit 04c7b18
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions autoload/rails.vim
Expand Up @@ -3043,12 +3043,11 @@ function! s:readable_related(...) dict abort
if a:0 && a:1
let lastmethod = self.last_method(a:1)
if self.type_name('controller','mailer') && lastmethod != ""
let root = s:sub(s:sub(s:sub(f,'/application%(_controller)=\.rb$','/shared_controller.rb'),'/%(controllers|models|mailers)/','/views/'),'%(_controller)=\.rb$','/'.lastmethod)
let format = self.format(a:1)
if glob(self.app().path().'/'.root.'.'.format.'.*[^~]') != ''
return root . '.' . format
let view = self.resolve_view(lastmethod, line('.'))
if view !=# ''
return view
else
return root
return s:sub(s:sub(s:sub(f,'/application%(_controller)=\.rb$','/shared_controller.rb'),'/%(controllers|models|mailers)/','/views/'),'%(_controller)=\.rb$','/'.lastmethod)
endif
elseif f =~ '\<config/environments/'
return "config/database.yml#". fnamemodify(f,':t:r')
Expand Down

0 comments on commit 04c7b18

Please sign in to comment.