Displaying information from one model on all views in an application

I've created a model that I plan to use to store messages that I want to be broadcast on every page of my application. I'm storing the message text, a class name for css styling, and a start and end timestamp that I want it to display between.

I was trying to find a way to insert these items into my application.html.erb layout template so that I don't have to include something in every single view. There is also a controller set up for the message items. Hopefully someone can help me with this, let me know if you need any more info.

you can use a before_filter in the application controller. in the method called by before_filter fetch the data you want from the model and store the result in an instance variable, e.g. @message create a partial that use this @message variable and insert it in your application layout.

Take a look here: http://railscasts.com/episodes/103-site-wide-announcements

Darian Shimy

thanks guys, i'll take a look