Skip to content

Commit

Permalink
Define a missing method #root for the development configurator
Browse files Browse the repository at this point in the history
This fixes an unexpected NoMethodError that experimenting through `bin/console` causes:

```
irb(main):001> Kredis.string "mystring"

/rails/kredis/lib/kredis/connections.rb:15:in `block in configured_for': undefined method `root' for an instance of #<Class:0x0000000108091a60> (NoMethodError)

      if configurator.root.join("config/redis/#{name}.yml").exist?
                     ^^^^^
```

This is a follow-up to #135.
  • Loading branch information
sato11 committed Mar 4, 2024
1 parent 14c7575 commit 35dcdaf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ end

require "debug"

Kredis.configurator = Class.new { def config_for(name) { db: "2" } end }.new
Kredis.configurator = Class.new do
def config_for(name) { db: "2" } end
def root() Pathname.new(".") end
end.new
ActiveSupport::LogSubscriber.logger = ActiveSupport::Logger.new(STDOUT)

IRB.start

0 comments on commit 35dcdaf

Please sign in to comment.