-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improved performance with counter_cache for tags (tag.taggings_count) #390
Conversation
Can you rebase against master and force push? |
I will not be able to do it in the following days, but if you can wait a little bit I will do it. |
Great! |
Rebase and remove whitespace? |
Done! Tests are green, though I've no time atm to manually check everything is working as expected. |
@dgilperez could you revert your change to db/migrate/1_acts_as_taggable_on_migration.rb and create another migration that will add the counter_cache ? PS: how did you add a commit 2 years ago ? :) |
@seuros My guess is @dgilperez cherry-picked an older commit from a previous PR when making this one... :) |
or he is a time traveler ! I tested this PR, everything looks fine. |
;) Good guess, I cherry-picked that commit from @lichtamberg like two years ago. I rebased again, added the migration code in a new migration file and merged the commits into a single one. Please tell me if you need anything else done. Thanks! |
TaggableModel.create(:name => "Bob", :tag_list => "ruby, rails, css") | ||
TaggableModel.tagged_with("ruby").first.should_not be_readonly | ||
end | ||
else |
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.
Rather than using xit
to temporarily disable the test, maybe just set it as pending 'until we figure out how to test this'
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.
Done!
Looks good to merge. Wanna update the CHANGELOG? (It's new) |
Would you mind rebasing / squashing some of these commits, e.g. remove whitespace added in earlier commit? |
@bf4 rebased again and squashed! About the CHANGELOG: What would you say this is for a change? A new Thanks !!! |
I think you should expand the Misc by added "Performance" to it. Place the others in the 'Unsorted' Also please look at #449 for the migration syntax. |
@seuros Performance is a good category. (This is a format I'm working on. Originally, I wanted to translate semver into English/devglish for the changelog. I should update notes in the rubygems style guide) I don't consider a migration, on its own, a breaking change. Breaking change is w/r/t a change in expected behavior (e.g. returns different type) or the way to achieve it (e.g. method signature) from previous releases. |
@bf4 While some migration can be ignored ( add_index, add comment, default value), some migrations like #390 are not optional, updating the gem and not applying the migration will cause the immediate malfunction of the application . If the database user is not a super user or has no right to alter the table. Updating the gem will cause the application to crash after the next deploy. So the notice is useful to warn for the maintenance that should be done ((Turning off/Reconfiguring) database watchers/Alter user rights, ect) |
@seuros so another major version bump? ugh. Maybe we can check columns for |
@bf4 the check will be perfect, then we can remove #390 from the breaking change section. @dgilperez Can you implement this check ? |
You may want to reuse this pattern from cache https://github.com/mbleigh/acts-as-taggable-on/blob/master/lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb#L25 |
@bf4 @seuros I'm not quite sure on how to implement that. Maybe something in this line, from the suggested pattern? (quick & dirty).
Please help! |
First off |
Sorry guys, this is a bit ahead of my capabilities ... and worse than that, I'm leaving tomorrow for some days off and won't have much time in the next few weeks ... please feel free to step ahead, otherwise I'll come over as soon as I can. Thanks for your directions and help on this in any case !!! |
Well, I put it in a local branch so someone (not necessarily me) can finish it https://github.com/mbleigh/acts-as-taggable-on/tree/dgilperez-counter_cache |
I'm a sucker for this stuff sometimes. Let's see if Travis passes. Please also test yourself, both before and after running the migration, if possible. https://travis-ci.org/mbleigh/acts-as-taggable-on/builds/16298201 |
[Fix] counter_cache, Check for #390 to prevent application breakage.
Merged in manually f891175 and #390 (reference) |
Add counter cache mbleigh#390
See #126 for reference.