@@ -847,16 +847,6 @@ endfunction
847847
848848call s: add_methods (' app' , [' ruby_shell_command' ,' execute_ruby_command' ,' background_ruby_command' ,' lightweight_ruby_eval' ,' eval' ])
849849
850- function ! RailsEval (ruby ,... ) abort
851- if ! exists (" b:rails_root" )
852- return a: 0 ? a: 1 : " "
853- elseif a: 0
854- return rails#app ().eval (a: ruby ,a: 1 )
855- else
856- return rails#app ().eval (a: ruby )
857- endif
858- endfunction
859-
860850" }}}1
861851" Commands {{{1
862852
@@ -1025,7 +1015,7 @@ endfunction
10251015call s: add_methods (' app' ,[' tags_command' ])
10261016
10271017function ! s: Refresh (bang )
1028- if exists (" g:rubycomplete_rails" ) && g: rubycomplete_rails && has (" ruby" )
1018+ if exists (" g:rubycomplete_rails" ) && g: rubycomplete_rails && has (" ruby" ) && exists ( ' g:rubycomplete_completions ' )
10291019 silent ! ruby ActiveRecord::Base.reset_subclasses if defined?(ActiveRecord)
10301020 silent ! ruby if defined?(ActiveSupport::Dependencies); ActiveSupport::Dependencies.clear ; elsif defined?(Dependencies); Dependencies.clear ; end
10311021 if a: bang
@@ -3902,15 +3892,9 @@ function! s:app_dbext_settings(environment) dict
39023892 if ! has_key (cache,a: environment )
39033893 let dict = {}
39043894 if self .has_file (" config/database.yml" )
3905- let out = " "
3906- if has (" ruby" )
3907- ruby require ' yaml' ; VIM:: command (' let out = %s' % File.open (VIM:: evaluate (" self.path()" )+ " /config/database.yml" ) {|f | y = YAML: : load (f ); e = y [VIM:: evaluate (" a:environment" )]; i = 0 ; e = y [e ] while e .respond_to?(:to_str) && (i += 1 )<16 ; e .map {|k,v| "#{k}=#{v}\n" if v}.compact.join }.inspect) rescue nil
3908- endif
3909- if out == " "
3910- let cmdb = ' require %{yaml}; File.open(%q{' .self .path ().' /config/database.yml}) {|f| y = YAML::load(f); e = y[%{'
3911- let cmde = ' }]; i=0; e=y[e] while e.respond_to?(:to_str) && (i+=1)<16; e.each{|k,v|puts k.to_s+%{=}+v.to_s}}'
3912- let out = self .lightweight_ruby_eval (cmdb.a: environment .cmde)
3913- endif
3895+ let cmdb = ' require %{yaml}; File.open(%q{' .self .path ().' /config/database.yml}) {|f| y = YAML::load(f); e = y[%{'
3896+ let cmde = ' }]; i=0; e=y[e] while e.respond_to?(:to_str) && (i+=1)<16; e.each{|k,v|puts k.to_s+%{=}+v.to_s}}'
3897+ let out = self .lightweight_ruby_eval (cmdb.a: environment .cmde)
39143898 let adapter = s: extractdbvar (out,' adapter' )
39153899 let adapter = get ({' postgresql' : ' pgsql' , ' sqlite3' : ' sqlite' , ' sqlserver' : ' sqlsrv' , ' sybase' : ' asa' , ' oci' : ' ora' },adapter,adapter)
39163900 let dict [' type' ] = toupper (adapter)
0 commit comments