[openstreetmap/openstreetmap-website] Add counts for notes and diary comments to user profiles (#1774)

Tom Hughes notifications at github.com
Fri Mar 2 22:28:09 UTC 2018

tomhughes commented on this pull request.

> @@ -25,7 +25,7 @@
 class NoteComment < ActiveRecord::Base
   belongs_to :note, :foreign_key => :note_id, :touch => true
-  belongs_to :author, :class_name => "User", :foreign_key => :author_id
+  belongs_to :author, :class_name => "User", :foreign_key => :author_id, :counter_cache => :notes_count

I don't think you can using the builtin counter caches, or at least I tried various things without any success.

The general suggestion seems to be https://github.com/magnusvk/counter_culture which allows for conditional counters.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20180302/8d5d4096/attachment.html>

More information about the rails-dev mailing list