KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm attempting to post a random testimonial on each page of a site. I started off by using an application helper like this: module ApplicationHelper def random_testimonial @random_testimonial = Testimonial.find(:first, :offset => rand(Testimonial.count)) end end In my view I can reference the method but it's being called on each reference, which makes sense. I'd like this to be called once on each page view exposing a Testimonial object I can use within the view. What should I be looking for to do this?
Tags (comma-separated)
Save Edits
Cancel