Can I create a default property on the base Application_Controller that can be accessed in my application.html.haml view?
What I’m trying to do is show a random quote on every page of the site. I have the quotes working, no problems, but I have to set
@quote = Quote.first(:order => "RANDOM()")
on every method in every controller. There must be a DRYer way than that?
Cheers
Ben
You’re on the right way.
Wrap your query in a before_filter inside your ApplicationController and add in your application layout the necessary stuff to display your result.