-
Notifications
You must be signed in to change notification settings - Fork 216
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
caching not working as expected #82
Comments
Open |
create_table "votes", force: true do |t| |
You don't have any of the cache columns on your table. Please see this page: https://github.com/ryanto/acts_as_votable#caching |
I have the cached columns under my other model as stated in the link given: create_table "cards", force: true do |t| |
Whoops, sorry about that. What version of ruby and what version of rails? |
action@cerebral-depravity-120411: |
What happens when you try the following?
Looking at the votable.rb, it looks like This still doesn't explain why your caching is not updating though... Did you run the following command force caching of existing votes for the votable model? I am assuming the model is Card. Also you don't need to call .size on |
Yep, I ran the
in the migration. Then @card.cached_votes_up still gives me 0. I can't see the column updating either. |
I guess I was doing something wrong because it is working now. Thanks for your support!!! |
if anyone else runs into this issue of the cache seemingly not working, a restart of the rails server just might fix it. =) |
What error output are you getting? The information will help in figuring out the source of your issue. I am going off the assumption your results are not being ordered correctly. Do you have a default scope set on your |
The problem was in the migration, somehow. Try and rewrite it that might help |
The issue for me was that I was only utilizing
note: |
I ran the migration as shown in the readme, but whenever I do object.get_likes.size it still queries the votes table without hitting the cache. Additionally the cache columns are not automatically updating with new votes. Are there any procedures to perform?
Score: <%[email protected]_likes.size - @card.get_dislikes.size%>
Cached Score: <%[email protected]_votes_up.size - @card.cached_votes_down.size%>
The text was updated successfully, but these errors were encountered: