Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Prioritize migrations with exact name
  • Loading branch information
tpope committed Feb 26, 2011
1 parent 0a55cda commit 5db62b2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions autoload/rails.vim
Expand Up @@ -2488,11 +2488,15 @@ function! s:app_migration(file) dict
else
let glob = '*'.rails#underscore(arg).'*rb'
endif
let migr = s:sub(glob(self.path('db/migrate/').glob),'.*\n','')
if s:startswith(migr,self.path())
let migr = strpart(migr,1+strlen(self.path()))
endif
return migr
let files = split(glob(self.path('db/migrate/').glob),"\n")
call map(files,'strpart(v:val,1+strlen(self.path()))')
let keep = get(files,0,'')
if glob =~# '^\*.*\*rb'
let pattern = glob[1:-4]
call filter(files,'v:val =~# ''db/migrate/\d\+_''.pattern.''\.rb''')
let keep = get(files,0,keep)
endif
return keep
endfunction

call s:add_methods('app', ['migration'])
Expand Down

0 comments on commit 5db62b2

Please sign in to comment.