Re: Difference between local and live server...

rein.henrichs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Thu, 30 Aug 2007 17:41:11 -0000

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.

On Aug 30, 10:56 am, Joe Peck
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:
> Yello,
>
> I''m setting my layout in a before_filter.
>
> Here is what I have in application.rb:
> before_filter :find_current_site
>
> layout $layout
>
> def find_current_site
>
>   if blahblahblah
>     $layout = "joe1"
>   else
>     $layout = "joe2"
>   end
>
> end
>
> It''s working on my local mongrel server, but on my live server
(also
> mongrel) I always end up with no layout, no matter how many times I
> refresh.
>
> Does anyone know what is going on here?
> --
> Posted viahttp://www.ruby-forum.com/.