-
-
Notifications
You must be signed in to change notification settings - Fork 300
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
Make sure rack_cache[:verbose] can be set #103
Conversation
633f1c0
to
2fbed08
Compare
@@ -116,7 +116,8 @@ def self.unsubscribe(component, subscriber) | |||
|
|||
def self.setup(app) | |||
self.application = app | |||
app.config.action_dispatch.rack_cache[:verbose] = false if app.config.action_dispatch.rack_cache | |||
app.config.action_dispatch.rack_cache[:verbose] = false if app.config.action_dispatch.rack_cache && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest moving the boolean check into a method to make the code a bit cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback! Now with private method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thank you, looks great so far. |
Before this change, the following config setting which is provided as example in production.rb of current rails versions: config.action_dispatch.rack_cache = true would result in a startup failure. Fixes roidrage#52
2fbed08
to
5595778
Compare
👯 |
@@ -116,7 +116,7 @@ def self.unsubscribe(component, subscriber) | |||
|
|||
def self.setup(app) | |||
self.application = app | |||
app.config.action_dispatch.rack_cache[:verbose] = false if app.config.action_dispatch.rack_cache | |||
app.config.action_dispatch.rack_cache[:verbose] = false if rack_cache_hashlike?(app) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app.config.action_dispatch.rack_cache[:verbose] = !rack_cache_hashlike?(app)
More concise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would not work - because then :[]=
would always be called on rack_cache
, raising the error that this commit is trying to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mybad. I see now. I guess it's a somewhat confusing use of a predicate.
Thanks <3 |
Make sure rack_cache[:verbose] can be set
I think this would deserve a change log entry. 🎅 |
This exploded for me. Copied a commit from lograge which solved the same issue: roidrage/lograge#103
This exploded for me. Copied a commit from lograge which solved the same issue: roidrage/lograge#103
This exploded for me. Copied a commit from lograge which solved the same issue: roidrage/lograge#103
This exploded for me. Copied a commit from lograge which solved the same issue: roidrage/lograge#103
This exploded for me. Copied a commit from lograge which solved the same issue: roidrage/lograge#103
This exploded for me. Copied a commit from lograge which solved the same issue: roidrage/lograge#103
This exploded for me. Copied a commit from lograge which solved the same issue: roidrage/lograge#103
This exploded for me. Copied a commit from lograge which solved the same issue: roidrage/lograge#103
Before this change, the following config setting which is provided as
example in production.rb of current rails versions:
config.action_dispatch.rack_cache = true
would result in a startup failure.
Fixes #52