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 :D
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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 :D > >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 --------------------------------------- http://www.autopendium.co.uk stuff about old cars --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ok, I will do that. I thought there was any rails object to ask for that (in the request or something) Thanks :D -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---