RE: Defining a variable in the environment and using itincon


Well, environment is done once… So @pagemeta won’t work because it’s a
scope issue. You can, however, create and set constants in the
environment.rb file, but you won’t be able to override them.

Here’s one way to achieve what you’re trying to do:

In /controllers/application.rb

put this right after the class definition:

before_filter :setup

set up any global variables that you want to use.

Call this through a filter so it’s called on every request.

def setup

@pagemeta = {:title => ‘Default page title’,
:description => ‘Default page description’,
:keywords => ‘Default page keywords’}

Then you should be able to use the variable in your pages.

Does that help?