-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config not working as expected in development #701
Comments
Hello @reefdog , can you please confirm that you're talking about |
I hacked some specs and looks like it's not using the expect(File).to receive(:exist?)
.with(Pathname.new(__dir__).join('config', 'chewy.yml')).and_return(true)
expect(File).to receive(:read).and_return(<<~YAML)
development:
request_strategy: :bypass
YAML
expect(subject.configuration[:request_strategy]).to eq(:bypass)
expect(subject.request_strategy).to eq(:bypass) and it fails in the last assertion. |
@jonatas Gah, yes So your test proves that Chewy isn't correctly parsing config out of the YAML file, then? |
Please fix it by using the file in the initializers folder as you suggested or submit a PR with the fix. |
@jonatas I'm happy to look into contributing a fix, but I'm confused as to why the documentation says to use My assumption is that I was doing something wrong, but does configuration via YAML not work at all? If so, any idea why it's documented? Did it work at one point and then stop? |
Also, note that we couldn't get either of the two documented solutions to work. The docs say that we should use the initializer like so: # config/initializers/chewy.rb
Chewy.settings = { request_strategy: :bypass } But we had to assign it directly, as documented in the original comment: # config/initializers/chewy.rb
Chewy.request_strategy = :bypass (I've edited the original comment to explicitly add the failing initializer approach.) |
This is a duplicate of #495 At rails console strategy We should change it |
Hey folks. Unsure what's going awry here, so please let me know what else we can provide.
We're using Chewy 5.1.0 with Rails 5.2 and Ruby 2.5.7. For some reason, neither of the documented approaches for configuration (
config/chewy.yml
or an initializer withChewy.settings = {...}
) are working.Specifically, we're trying to set
request_strategy
to:bypass
in development using either of the documented approaches:But neither one works and it remains
:atomic
:The only way we can get this to stick is with an initializer that assigns
Chewy.request_strategy
directly:Which then creates the expected result:
(And yes, I confirmed the Rails env is
development
.)I'm assuming most people don't have trouble with config, or this would be a bigger deal. So any ideas for how we can figure out what's going on?
🙏
The text was updated successfully, but these errors were encountered: