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:

  1. install gem.
  2. run generator.
  3. add column counter_cache migration.
  4. run rake db:migrate.
  5. add impressionist :actions=>[:show] controller want track impressions from.
  6. add is_impressionable :counter_cache => true model pertaining controller above.
  7. restart server.

i have 2 questions:

  1. why doesn't counter_cache number increased each impression (and each respective record)?
  2. 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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -