Accessing controller specific variables application-wide

Not sure if I described this the best in the subject, but here is my

I have a ‘settings’ table, that I am storing application configuration
data. On my settings “edit” page, I am just grabbing the first entry
(you can’t add more entries, again, just a config table)

@setting = Setting.find(1)

I need to access some of that data in the main layout. For instance, the
color (hex) of the template. The “name” of the application, etc.

How would I go about doing that?

Many ways to do this.
Either declare a before_filter in application.rb and load
the settings every time

before_filter :load_settings

def load_settings
@setting = Setting.find(1)

Or, if you don’t need it that often, you can define a method

def get_settings
@setting ||= Setting.find(1)

This will load the setting the first time it’s called. If it was
before, it just returns the @setting