flash[:error] -- nothing happens

in the case of invalid login, the method bellow does nothing at
flash[:error], just goes directly to =>welcome page.
is something missing something?

def process_login
    if user = User.authenticate(params[:user])
        session[:id] = user.id
        redirect_to session[:return_to] || '/'
    else
        flash[:error] = "Invalid login."
        puts 'error'
        redirect_to :controller => 'main', :action =>
'welcome', :username => params[:user][:username]
    end
end

in *.erb code is as follows

  <% if flash[:message] %>
    <div><%= flash[:message] %></div>
  <% end %>

  <% if flash[:error] %>
    <div><%= flash[:error] %></div>
  <% end %>

anti wrote:

in *.erb code is as follows

Is it really in all of your .erb files? In a layout file?

If I understand correctly, you're expecting it to show the error on the
welcome page, yes? If so, is the flash stuff in the Welcome.html.erb
file, or the layout it uses?

jp

anti wrote:

in the case of invalid login, the method bellow does nothing at
flash[:error], just goes directly to =>welcome page.
is something missing something?

How is the "welcome" action in your "main" controller defined? What
entries are there in your log file during invalid login processing (at
least processing, parameter and rendering lies)?

anti wrote:

in the case of invalid login, the method bellow does nothing at
flash[:error], just goes directly to =>welcome page.
is something missing something?

def process_login
    if user = User.authenticate(params[:user])
        session[:id] = user.id
        redirect_to session[:return_to] || '/'
    else
        flash[:error] = "Invalid login."
        puts 'error'
        redirect_to :controller => 'main', :action =>
'welcome', :username => params[:user][:username]
    end
end

in *.erb code is as follows

  <% if flash[:message] %>
    <div><%= flash[:message] %></div>
  <% end %>

  <% if flash[:error] %>
    <div><%= flash[:error] %></div>
  <% end %>

hi anti...

the prob here is u have to specify even the id of the div
it should be probably like this
try once

<div id= 'error'><%= flash[:error] %></div>

this is it.

If I understand correctly, you're expecting it to show theerroron the
welcome page, yes? If so, is theflashstuff in the Welcome.html.erb
file, or the layout it uses?

theflashstuff has to be on the destination page, welcome.html.erb in
this case.

theflashstuff goes on the same page when the action is to itself.

this is it.

If I understand correctly, you're expecting it to show theerroron the
welcome page, yes? If so, is theflashstuff in the Welcome.html.erb
file, or the layout it uses?

theflashstuff has to be on the destination page, welcome.html.erb in
this case.

theflashstuff goes on the same page when the action is to itself.