@@ -2132,6 +2132,7 @@ function! s:BufFinderCommands()
21322132 call s: addfilecmds (" controller" )
21332133 call s: addfilecmds (" mailer" )
21342134 call s: addfilecmds (" migration" )
2135+ call s: addfilecmds (" schema" )
21352136 call s: addfilecmds (" observer" )
21362137 call s: addfilecmds (" helper" )
21372138 call s: addfilecmds (" layout" )
@@ -2287,6 +2288,14 @@ function! s:migrationList(A,L,P)
22872288 endif
22882289endfunction
22892290
2291+ function ! s: schemaList (A,L,P )
2292+ let tables = s: readfile (rails#app ().path (' db/schema.rb' ))
2293+ let table_re = ' ^\s\+create_table\s["'' :]\zs[^"'' ,]*\ze'
2294+ call map (tables,' matchstr(v:val, table_re)' )
2295+ call filter (tables,' strlen(v:val)' )
2296+ return s: autocamelize (tables, a: A )
2297+ endfunction
2298+
22902299function ! s: unittestList (A,L,P )
22912300 let found = []
22922301 if rails#app ().has (' test' )
@@ -2516,6 +2525,15 @@ function! s:migrationEdit(cmd,...)
25162525 endif
25172526endfunction
25182527
2528+ function ! s: schemaEdit (cmd,... )
2529+ let cmd = s: findcmdfor (a: cmd )
2530+ let schema = ' db/' .s: environment ().' _structure.sql'
2531+ if rails#app ().has_file (' db/schema.rb' ) || ! rails#app ().has_file (schema)
2532+ let schema = ' db/schema.rb'
2533+ endif
2534+ call s: findedit (cmd,schema.(a: 0 ? ' #' .a: 1 : ' ' ))
2535+ endfunction
2536+
25192537function ! s: fixturesEdit (cmd,... )
25202538 if a: 0
25212539 let c = rails#underscore (a: 1 )
0 commit comments