Checking redirection or the previous action

Damaris Fuentes wrote:

Hi you all,
I have two actions in my controller in this way:

def list_by_bubble
    Bla bla bla
    redirect_to(:action => 'list_by_filter')
end
def list_by_filter
  #To display always
  Bla bla bla
  #To display just the rest of the times
  Bla bla bla
end

That is, the first time, user will go to list_by_bubble, and it
redirects to list_by_filter. In this method, I just one to display the
"display always stuff", not the other. The other stuff will be executed
the rest of the times, but not this first time.
So, my question is, how can I get in "list_by_filter" if the previous
action was "list_by_bubble" or not? Or if I have reached there by a
redirection?

Thanks :smiley:

Not sure I understand what you're trying to do. It sounds like you might want to have a single list action, with a default set of parameters:

def list
  if #first time visited here
    foo
  else
    bar
  end
end

The condition could be set a number of ways -- in the session, with a cookie, or via a flag in the user's record.

Hope this helps
Chris