lib/sunspot-rails-failover.rb in sunspot-rails-failover-0.0.3 vs lib/sunspot-rails-failover.rb in sunspot-rails-failover-0.0.4

- old
+ new

@@ -9,30 +9,25 @@ attr_accessor :exception_handler def setup Sunspot.session = if Sunspot::Rails.configuration.has_master? Sunspot::SessionProxy::MasterSlaveWithFailoverSessionProxy.new( - Sunspot::Session.new(master_config), Sunspot::Session.new(slave_config) + SessionProxy::ThreadLocalSessionProxy.new(master_config), + SessionProxy::ThreadLocalSessionProxy.new(slave_config) ) else Sunspot::SessionProxy::ThreadLocalSessionProxy.new(slave_config) end end private def slave_config - build_config('solr', 'url') + Sunspot::Rails.send :slave_config, Sunspot::Rails.configuration end def master_config - build_config('master_solr', 'url') - end - - def build_config(*keys) - Sunspot::Configuration.build.tap do |config| - config.solr.url = Sunspot::Rails.configuration.send :user_configuration_from_key, *keys - end + Sunspot::Rails.send :master_config, Sunspot::Rails.configuration end end end end end \ No newline at end of file