Counter_cache Not Updated In Ajax
I have a js code that is run a like link is clicked (with ajax) - The link changes to unlike (with the proper route and method), and I want the likes_count which is a column in the
Solution 1:
in your create method, exactly after saving your object, you should reload
the object that you like it, something like this :
def create
# some code
if @like.save
@artwork.reload # use reload to get the updated counter cache value
end
end
Post a Comment for "Counter_cache Not Updated In Ajax"