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.