[Rails] Action Variables Not Available In The View For A Specific Action

Jeremy Kemper
Wed, 10 May 2006 18:44:02 -0000

On May 10, 2006, at 10:31 AM, Jeff Ward wrote:
> I am setting an action variable in my PagesController such as:
>
> def manage
>   render(:layout => "admin")
>   @strOut = "STRING Variable Set From The MANAGE Action!"
> end
>
> And in the /views/pages/manage.rhtml view, I don?t have access to that
> @strOut variable by trying to call it as: <%= @strOut %>

You set the variable after the view was rendered. Swap those two lines.

jeremy