I need to display all the posted variables and their values. I am not sure how I would go about doing this. Is there a way to loop through all the posted variables regardless of how many are passed so I could display them on a webpage? Thanks, -S -- 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 -~----------~----~----~----~------~----~------~--~---
On 15 Sep 2008, at 22:09, Shandy Nantz wrote:> > I need to display all the posted variables and their values. I am not > sure how I would go about doing this. Is there a way to loop through > all > the posted variables regardless of how many are passed so I could > display them on a webpage? Thanks,They''re all in the params hash, which is just a regular ruby hash. Fred> > > -S > -- > 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> > They''re all in the params hash, which is just a regular ruby hash. > > FredI understand that part, but what if I don''t neccissarily know the names of the hash values? I know that there is always params[:action] and params[:controller], but what if I had params[:id] when I hit one method but when I hit another method I have a params[:admin_id], or something completely different. I guess when I am trying to ask (and the easy way would probably be just to try and see if it works) is, can I say params.each and then loop through all the values that are passed in regardless of what they are named before hand? Thanks, -S -- 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 -~----------~----~----~----~------~----~------~--~---
On Tue, Sep 16, 2008 at 3:52 PM, Shandy Nantz < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Frederick Cheung wrote: > > > > They''re all in the params hash, which is just a regular ruby hash. > > > > Fred > > I guess when I am trying to ask (and the easy way > would probably be just to try and see if it works) is, can I say > params.each and then loop through all the values that are passed in > regardless of what they are named before hand? Thanks,Since it''s a Hash, you can do each to go through the keys and values eg params.each { |k, v| puts "the key #{k} has value #{v}" } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---