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
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
On 15 Sep 2008, at 22:09, Shandy N. 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
On Tue, Sep 16, 2008 at 3:52 PM, Shandy N. <
[email protected]> wrote:
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}” }
Frederick C. wrote:
They’re all in the params hash, which is just a regular ruby hash.
Fred
I 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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs