Skip to content

Commit ffd2973

Browse files
committed
Disable automatic dbext config with g:rails_no_dbext
Closes tpope#282.
1 parent d660a59 commit ffd2973

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

autoload/rails.vim

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4008,20 +4008,22 @@ function! s:app_dbext_settings(environment) dict
40084008
return cache[a:environment]
40094009
endfunction
40104010

4011-
function! s:BufDatabase(...)
4011+
function! s:BufDatabase(level, ...)
40124012
if exists("s:lock_database") || !exists('g:loaded_dbext') || !exists('b:rails_root')
40134013
return
40144014
endif
40154015
let self = rails#app()
4016-
if (a:0 && a:1 > 1)
4016+
if a:level > 1
40174017
call self.cache.clear('dbext_settings')
4018+
elseif exists('g:rails_no_dbext')
4019+
return
40184020
endif
4019-
if (a:0 > 1 && a:2 != '')
4020-
let env = a:2
4021+
if (a:0 && !empty(a:1))
4022+
let env = a:1
40214023
else
40224024
let env = s:environment()
40234025
endif
4024-
if (!self.cache.has('dbext_settings') || !has_key(self.cache.get('dbext_settings'),env)) && (a:0 ? a:1 : 0) <= 0
4026+
if (!self.cache.has('dbext_settings') || !has_key(self.cache.get('dbext_settings'),env)) && a:level <= 0
40254027
return
40264028
endif
40274029
let dict = self.dbext_settings(env)

0 commit comments

Comments
 (0)