Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit e9204a4

Browse files
committed
:.Rake in controller runs rake routes CONTROLLER=
1 parent 11739c0 commit e9204a4

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

autoload/rails.vim

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ function! s:Rake(bang,lnum,arg)
11481148
if !a:bang
11491149
cwindow
11501150
endif
1151-
elseif arg =~# '^\%(stats\|routes\|secret\|time:zones\|db:\%(charset\|collation\|fixtures:identify\>.*\|version\)\)\%(:\|$\)'
1151+
elseif arg =~# '^\%(stats\|routes\|secret\|time:zones\|db:\%(charset\|collation\|fixtures:identify\>.*\|version\)\)\%([: ]\|$\)'
11521152
let &l:errorformat = '%D(in\ %f),%+G%.%#'
11531153
exe 'make! '.arg
11541154
if !a:bang
@@ -1258,6 +1258,14 @@ function! s:readable_default_rake_task(lnum) dict abort
12581258
endif
12591259
elseif self.name() =~# '\<db/seeds\.rb$'
12601260
return 'db:seed'
1261+
elseif self.type_name('controller') && lnum
1262+
let lm = self.last_method(lnum)
1263+
if lm != ''
1264+
" rake routes doesn't support ACTION... yet...
1265+
return 'routes CONTROLLER='.self.controller_name().' ACTION='.lm
1266+
else
1267+
return 'routes CONTROLLER='.self.controller_name()
1268+
endif
12611269
elseif app.has('spec') && self.name() =~# '^app/.*\.rb' && app.has_file(s:sub(self.name(),'^app/(.*)\.rb$','spec/\1_spec.rb'))
12621270
return 'spec SPEC="%:p:r:s?[\/]app[\/]?/spec/?_spec.rb" SPEC_OPTS='
12631271
elseif t=~ '^model\>'

doc/rails.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ functional test test:functionals TEST=... TESTOPTS=-n...
592592
integration test test:integration TEST=... TESTOPTS=-n...
593593
spec spec SPEC=... SPEC_OPTS=--line=...
594594
feature cucumber FEATURE=...:...
595+
controller routes CONTROLLER=...
595596
fixtures db:fixtures:identify LABEL=...
596597
migration in self.up db:migrate:up VERSION=...
597598
migration in self.down db:migrate:down VERSION=...

0 commit comments

Comments
 (0)