Re: Page view count

vanquisher
2007-06-10T05:23:46Z

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????



On Jun 9, 2:25 pm, "James Brooks"
<white...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> 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
>
> On 6/9/07, Tyche
<chandra.so...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
>
>
> > 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- Hide quoted text -
>
> - Show quoted text -