I have an ad list that needs to be displayed in all the pages of my site, so I added the list to the application layout. Something like this:
<div>
<%= render @ads %>
<div>
I want the ad list to be retrieved from the db before the application layout is rendered, but not when another layout is used, so I guess that before_filter is not the solution, right?
Where should I put this code?
@ads = Ad.all
Thanks in advance!
Given that the ads list should be displayed on every page of the site, then something like this should work: