Skip to content

Commit

Permalink
Check that @config exists. Fixes thiagopradi#413
Browse files Browse the repository at this point in the history
Error message is:

ActiveRecord::StatementInvalid: NoMethodError: undefined method `[]' for
nil:NilClass:

  from octopus/lib/octopus/abstract_adapter.rb:23:in `octopus_shard'
  from octopus/lib/octopus/abstract_adapter.rb:12:in `instrument'
  from vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:478:in `log'

This has shown to surface in the ibm_db and sqlserver adapters.
  • Loading branch information
calh committed Jun 26, 2019
1 parent 8e2671d commit 3e9f50b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/octopus/abstract_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def method_missing(meth, *args, &block)
end

def octopus_shard
@config[:octopus_shard]
@config && @config[:octopus_shard]
end

def initialize(*args)
Expand Down

0 comments on commit 3e9f50b

Please sign in to comment.