Skip to content
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

Merged
merged 1 commit into from
Feb 1, 2015

Conversation

til
Copy link
Contributor

@til til commented Jan 31, 2015

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

@@ -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 &&
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pxlpnk
Copy link
Collaborator

pxlpnk commented Jan 31, 2015

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
@pxlpnk
Copy link
Collaborator

pxlpnk commented Jan 31, 2015

:shipit: 👯

@@ -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)
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

@benlovell
Copy link
Collaborator

Thanks <3

benlovell added a commit that referenced this pull request Feb 1, 2015
Make sure rack_cache[:verbose] can be set
@benlovell benlovell merged commit 149b927 into roidrage:master Feb 1, 2015
@pxlpnk
Copy link
Collaborator

pxlpnk commented Feb 1, 2015

I think this would deserve a change log entry. 🎅

pxlpnk added a commit to pxlpnk/lograge that referenced this pull request Feb 1, 2015
benlovell added a commit that referenced this pull request Feb 1, 2015
@pxlpnk pxlpnk mentioned this pull request Feb 7, 2015
jdurand added a commit to jdurand/logstasher that referenced this pull request Jan 28, 2016
This exploded for me.
Copied a commit from lograge which solved the same issue:
roidrage/lograge#103
jdurand added a commit to jdurand/logstasher that referenced this pull request Jan 28, 2016
This exploded for me.
Copied a commit from lograge which solved the same issue:
roidrage/lograge#103
jdurand added a commit to jdurand/logstasher that referenced this pull request Jan 28, 2016
This exploded for me.
Copied a commit from lograge which solved the same issue:
roidrage/lograge#103
jdurand added a commit to jdurand/logstasher that referenced this pull request Jan 28, 2016
This exploded for me.
Copied a commit from lograge which solved the same issue:
roidrage/lograge#103
jdurand added a commit to jdurand/logstasher that referenced this pull request Jan 28, 2016
This exploded for me.
Copied a commit from lograge which solved the same issue:
roidrage/lograge#103
jdurand added a commit to jdurand/logstasher that referenced this pull request Jan 28, 2016
This exploded for me.
Copied a commit from lograge which solved the same issue:
roidrage/lograge#103
shadabahmed pushed a commit to shadabahmed/logstasher that referenced this pull request Apr 12, 2020
This exploded for me.
Copied a commit from lograge which solved the same issue:
roidrage/lograge#103
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

accommodating default rack-cache settings
3 participants