Difference between local and live server...

Use an instance variable. Global variables are a bad idea in general,
and especially in rails there is no need for them. One of the reasons
we have before_filters is to obviate the need for global variables.

Also, if you're using this for a layout, you can simply do

layout :find_current_site

and it will use the return value to determine the layout.