KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I just created a counter_cache field and the controller looks like this. @users = User.where(:sex => 2).order('received_likes_count') The association in User.rb is has_many :received_likes, :through => :attachments, :source => :likes, :dependent => :destroy Problem is that counter_cache is declared in the belong_to of Like.rb and I don't know how to tell it that is for the has_many :through association. belongs_to :user, :counter_cache => :received_likes
Tags (comma-separated)
Save Edits
Cancel