Skip to content

Commit

Permalink
@clearners may not be initialized
Browse files Browse the repository at this point in the history
in case configuring a cleaner via `[]` before touching AR::Base

fixes #85
  • Loading branch information
amatsuda committed Jan 9, 2024
1 parent 0075f56 commit fe8ed89
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/database_rewinder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def create_cleaner(connection_name)
end

def [](connection)
init unless defined? @cleaners

@cleaners.detect {|c| c.connection_name == connection} || create_cleaner(connection)
end

Expand Down

0 comments on commit fe8ed89

Please sign in to comment.