ruby on rails - How do I use the Impressionist gem? -
i'm using impressionist gem.
i want display hit counter of 1 particular page, in same view.
this did:
- install gem.
- run generator.
- add column
counter_cache
migration. - run
rake db:migrate
. - add
impressionist :actions=>[:show
] controller want track impressions from. - add
is_impressionable :counter_cache => true
model pertaining controller above. - restart server.
i have 2 questions:
- why doesn't counter_cache number increased each impression (and each respective record)?
- is there method can use in view display hit count, or should craft own query?
there method show how hits:
<%= @model_instance.impressionist_count %> views
put in view.
Comments
Post a Comment