I'm using the Impressionist gem.
I want to display a hit counter of one particular page, in that same view.
This is what I did:
counter_cache
to the migration. rake db:migrate
. impressionist :actions=>[:show
] to the controller that I want to track impressions from. is_impressionable :counter_cache => true
to the model pertaining to the controller above. I have two questions:
There is a method to show how much hits:
<%= @model_instance.impressionist_count %> views
Put this in your view.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.