I've been unable to retrieve most viewed posts in my app with impressionist gem. Everything works fine with normal page views. I've tried this on another app and it works well. The only difference between the two apps is that the one that that worked uses SQLITE while the other PG.
I've implemented it by installing the gem and running the migration
rails g migration add_impressions_count_to_posts impressions_count:integer
I've been unable to retrieve most viewed posts in my app with impressionist gem. Everything works fine with normal page views. I've tried this on another app and it works well. The only difference between the two apps is that the one that that worked uses SQLITE while the other PG.
I've implemented it by installing the gem and running the migration
rails g migration add_impressions_count_to_posts impressions_count:integer
Added this to Post.rb
is_impressionable :counter_cache => true
and
Post.order('impressions_count DESC')
Added this to posts_controller.rb in show action
@most_viewed = Post.order('impressions_count DESC').take(20)
And in my show page i have