On 20/8/2010 3:50 AM, Robert Walker wrote:
nirosh wrote:
i have a poem model. i need to display the most viewed poems.
is there any plug inns out there to do this?
Unless I'm missing something obvious, I wouldn't think a plugin would be
needed for this.

poems_controller.rb
--------------------
def show
   @poem = Poem.find(params[:id])
   @poem.increment!(:view_count)
   ...
   ...
end

...or use update_counters
http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001792

Cheers,
Mohit.
20/8/2010 | 4:00 AM.


--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to