to summarize i have an action that takes a bunch of form params and looks at everything.. depending on what is provided it passes these params off to different actions. the code i had before put the unsaved active record object in the flash where its attr_accessors got nicely preserved where it was retrieved from the flash in the next action. worked well and got the job done, but caused me much grief trying to write a functional test for this (see my ''functional testing woes'' topic for more details).. i''ve since tried to switch the code so instead of putting it in the flash i pass it along as params.. now why doesn''t this work? receive the params: @person = params[:person] look at @person to determine which action to branch off to.. PROBLEM: redirect_to :action => ''branch1'', :person => @person ^next action gets params[:person] => nil tried this also: redirect_to :action => ''branch1'', :person => params[:person] ^gets stringify keys error and params[:person] contains a big long string instead of actual hash and tried this too: redirect_to :action => ''branch1'', params ^it really hates this one so how do i do this? should i just stick to my flash hackery? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
There''s probably a way to do this, but have you considered making your dispatcher action a private method in application.rb? You could then use real actions that would call the private method and then redirect or do whatever else they need to. It would make it much easier to test and the code more readable. It''d be a little less DRY, but that''s probably ok. Forgive me if I''m not understanding your issue correctly. Cheers, John --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
just call the function and pass in the parameter. branch1(somthing) if @person.personType == ''orgre'' branch1(@person) end you can define branch1 in application.rb. -- 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 -~----------~----~----~----~------~----~------~--~---
stewbawka
2006-Dec-12 20:34 UTC
Re: receiving params and passing them to another action HELP
i''ll give these suggestions a try.. thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---