Skip to content

Commit

Permalink
Default replace_methods to false
Browse files Browse the repository at this point in the history
  • Loading branch information
gaffney committed May 26, 2023
1 parent e8148d8 commit 8d14c74
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/batch_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def initialize(item:, executor_proxy: nil)
def batch(default_value: nil, cache: true, replace_methods: nil, key: nil, &batch_block)
@default_value = default_value
@cache = cache
@replace_methods = replace_methods.nil? ? cache : replace_methods
@replace_methods = replace_methods.nil? ? false : replace_methods
@key = key
@batch_block = batch_block

Expand Down
2 changes: 1 addition & 1 deletion spec/batch_loader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
user = User.save(id: 1)
post = Post.new(user_id: user.id)

batch_loader = post.user_lazy
batch_loader = post.user_lazy(replace_methods: true)

expect(batch_loader.inspect).to match(/#<BatchLoader:0x\w+>/)
expect(batch_loader.to_s).to match(/#<User:0x\w+>/)
Expand Down

0 comments on commit 8d14c74

Please sign in to comment.