I'm trying to make a feed page where users can see the popular posts and the posts of whom they followed. This what I tried (but failed):
@popularPosts = Post.where(cached_votes_score > '2')
undefined local variable or method `cached_votes_score' for #<PagesController:0x007fa2ae08f630> Did you mean? cache_store
What you want is done:
Post.where('cached_votes_score > 2')
What you where trying to do was interpreted as trying to call a method cached_votes_score in the controller and comparing if its returned value is greater than
Rails doesn't have a Railsism to do greater than comparisons, so you do a SQL segment to accomplish it.