I have 2 action methods, action1 and action2. action1 is always run before action2. Short of using the dreaded global variable, how can I access a value developed in action1 from action2? Thanks for any input. ... doug --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
If you are redirecting to action2 at the end of action1, just append the value to the end of the redirect: my_var = <some logic> redirect_to :action => ''action2'', :my_var => my_var should work. Peace, Phillip On Dec 12, 2007, at 2:00 PM, doug wrote:> > I have 2 action methods, action1 and action2. action1 is always run > before action2. Short of using the dreaded global variable, how can I > access a value developed in action1 from action2? Thanks for any > input. > > ... doug > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Dec 13, 2007 1:30 AM, doug <ddjolley-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I have 2 action methods, action1 and action2. action1 is always run > before action2. Short of using the dreaded global variable, how can I > access a value developed in action1 from action2? Thanks for any > input. >u can send a value like this def action1 redirect_to :action => ''action2'', :value => params[:current_varaible] end def action2 puts params[:value].inspect end> > ... doug > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> If you are redirecting to action2 at the end of action1, just append > the value to the end of the redirect:Thanks to both responders. I appologize for not making clear that I''m not redirecting from action1 to action2. Actually this is a checkout system where action1 redirects to a checkout handler like PayPal and then after the checkout handler does its thing, we redirect to a fulfillment handler to complete the order. The bottom line is that action1 does not "call" action2; so, I can''t pass the information in the call. That would obviously make life much easier. Thanks for the input. Am I stuck with the dreaded global variable? ... doug --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Dec 12, 2007, at 4:30 PM, doug wrote:>> If you are redirecting to action2 at the end of action1, just append >> the value to the end of the redirect: > > Thanks to both responders. I appologize for not making clear that I''m > not redirecting from action1 to action2. Actually this is a checkout > system where action1 redirects to a checkout handler like PayPal and > then after the checkout handler does its thing, we redirect to a > fulfillment handler to complete the order. The bottom line is that > action1 does not "call" action2; so, I can''t pass the information in > the call. That would obviously make life much easier. > > Thanks for the input. Am I stuck with the dreaded global variable? > > ... dougA global variable is probably not going to help you anyway. If this "order" is in a database, then you may want to link this data that you need in action2 to the order as an attribute in the same table or in a new table the belongs_to :order (even if the need for the data is "temporary", you do need to handle concurrent users, right?). -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> (even if the need for > the data is "temporary", you do need to handle concurrent users, > right?).Yep and I think that alone dictates what I''m going to have to do. Thanks for helping me focus my thinking. ... doug --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---