views:

566

answers:

3

Hello,

I can't figure out why my flash messages disappear after a redirect_to. Started the debugger in my view, and the flash variable is totally empty.

flash
=> {}

The result is the same with flash.now... It works fine if I edit something and call render.

Controller:

  def create
    @user_session = UserSession.new(params[:user_session])
    if @user_session.save
      flash[:notice] = "Logged in"
      redirect_to root_url
    else
      render :action => 'new'
    end
  end

Application layout:

  - flash.each do |name, msg|
    =content_tag :div, msg, :class => "flash_#{name}"

root_url is another controller and action.

A: 

Hi,

Yes I am using rails 2.3.2. The controller only contains methods for a few special pages.

class PagesController < ApplicationController

  def home
    @contact_handler = ContactHandler.new
  end

  def faq
  end

  def contact
  end

end

This is my root_path

  map.root :controller => "pages", :action => "home"

Any ideas?

atmorell
+2  A: 

It was the render_component plugin... it breaks rails 2.3.2. Thanks anyway.

atmorell
I solved this issue by commenting out two lines in the render_component code--the line with flash.discard and flash.sweep. I don't know if this was the right solution, but it's allowing me to move forward at the moment.
Mario
A: 

How did you resolve this? - were you using Active Scaffold (hence the use of render_component)?

Just delete the render_component folder from vendor/plugins.... or remove the gem.
atmorell