I'm attempting to post a random testimonial on each page of a site. I started off by using an application helper like so:
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. Instead, 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?