-
Notifications
You must be signed in to change notification settings - Fork 210
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
Not updating dynamic weight when attribute is changed #195
Comments
Did you tried to check it out in rails console? class DistrictTest < ActiveSupport::TestCase
self.use_transactional_fixtures = false
...
end |
Looking at the code, it looks like you're right: This doesn't currently work. There's no way for counter_culture to know which column to watch for changes as you're just passing in a That being said, what you're trying to achieve does work with conditional counter caches, as documented here: https://github.com/magnusvk/counter_culture#conditional-counter-cache |
@magnusvk Do you think the following could work?
Then we could avoid forcing the user to have to define the columns. On the other hand it would require a bit more work if the |
The value would already be changed on See this for something similar. |
I have the following setup:
I am then speccing it like this:
Which fails with
expected: 1 got: 0
.I would expect counter culture to notice the change and change the weight from 0 to 1 and add the change in weight to the
active_sales_ads_count
column on the district.The text was updated successfully, but these errors were encountered: