Module: ActiveRecord::ConnectionHandling
- Defined in:
- lib/active_record/connection_adapters/elasticsearch_adapter.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#elasticsearch_connection(config) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/active_record/connection_adapters/elasticsearch_adapter.rb', line 26 def elasticsearch_connection(config) config = config.symbolize_keys # move 'username' to 'user' config[:user] = config.delete(:username) if config[:username] # append 'port' to 'host' config[:host] += ":#{config.delete(:port)}" if config[:port] && config[:host] # move 'host' to 'hosts' config[:hosts] = config.delete(:host) if config[:host] # enable logging (Rails.logger) config[:logger] = logger if config.delete(:log) ConnectionAdapters::ElasticsearchAdapter.new( ConnectionAdapters::ElasticsearchAdapter.new_client(config), logger, config ) end |