Page view count

Hi,
I am new to RoR and and web designing. I want to display page view
count on my home page. How do I do that?

Many thanks,
Tyche

Hi,

Here’s what you could do, you could create a PageHit model which might contain: request_uri and created_at. Every time a page is viewed, add a new one of these objects. To ensure they are for page views, you could add code for this to the top of your layouts (
application.rhtml in layouts, or whatever layouts your using).

ie, in application.rhtml
<% PageHit.create :request_uri => request.request_uri %>

Cheers,
James

James,
This looks straight forward. But, this is only increase the load on
the DB.
Everytime a URL is requested, we create transcations on DB.

Is there a better way of doing this?

Another way, as far as I understand is creating a pattern in the logs
and parse it to get the hit or view count.
But, we can run the parser only periodically....making it non-real
time.

Does anyone have a better way or suggest a plugin???