-
Notifications
You must be signed in to change notification settings - Fork 79
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
Global configuration for :ignore_log_data option #111
Conversation
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.
The current approach (model tracking and overriding) has one problem – it's not thread-safe.
And I don't think it's possible to make it thread-safe, unfortunately.
Looks like it's gonna be too complicated to patch this behaviour this way (via schema cache).
I have another idea: what if can add a default_scope
which is only activated when the corresponding Logidze parameter (thread-safe) is true
?
Smth like:
default_scope do
with_log_data if Logidze.force_load_ignore_log_data
end
?
This way we cover the scenario: "ignore log data by default" + "load within a block".
And I don't think we need the opposite (at least for now): "enable by default" + "ignore within a block". Doesn't make a lot of sense to me.
CHANGELOG.md
Outdated
Now it's possible to avoid loading `log_data` from the DB by default with | ||
|
||
```ruby | ||
Rails.application.config.logidze.select_ignore_log_data = true |
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.
Can't see where we add logidze
config to Rails.
Let's just use Logidze.ignore_log_data_by_default = true
(yeah, and rename the option).
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.
✔️
fe0a98f
to
5883104
Compare
The approach itself works fine (not all the tests are green now!), but the problem is that Since we're using |
I don't like the idea of replacing
This is not good for performance.
Looks like it uses some scope-less version of So, the problem is only with |
40e86ee
to
26ea844
Compare
@palkan Done! I've patched |
@DmitryTsepelev Looks good! Thanks! @aderyabin Check please; any questions/suggestions? |
e7c524d
to
04320b3
Compare
04320b3
to
4ae603d
Compare
@DmitryTsepelev Looks like Rails 4.2 can not do
Let's replace it with |
I bet our Rails 4 users still want to have working |
This is the implementation of #109. The idea is that we store a list of models that allow overriding the global setting (i.e. where
:ignore_log_data
is not specified) and when global setting is changed - we start or stop ignoring thelog_data
column.