so i have many controllers and many views.
i want my variable @random_quote to be evaluated each time every view loads up.
i tried several things in application controller(i thought it should be here?) but none of them worked.
so how do i connect these two: @random_quote.body (in view) and
@random_quote = Quote.find(:random) (in controller right?)
to bee seen through all my application?
thank you for your answers!
I doubt you actually need it to be accessible in all views. But you can put
@random_quote = Quote.find(:random)under a method that is called with abefore_filterin your ApplicationController. It will then be accessible everywhere.Like so: