# Iterating through all members of a variable?

**URL:** <https://www.ruby-forum.com/t/iterating-through-all-members-of-a-variable/92463>\
**Category:** Rails\
**Created:** [April 19, 2007, 8:00pm UTC](https://www.ruby-forum.com/t/iterating-through-all-members-of-a-variable/92463 "2007-04-19T20:00:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehudros](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3ec8ea/32.png) [@ehudros](https://www.ruby-forum.com/u/ehudros)\
**Post date:** [April 19, 2007, 8:00pm UTC](https://www.ruby-forum.com/t/iterating-through-all-members-of-a-variable/92463/1 "2007-04-19T20:00:23Z")

</div>

Hi everyone,  
I’m looking for a way to run a white\_list helper on all fields returned  
from a form. I want to do it in the controller (and not in the view),  
and do not want to specify the field names but to it dynamically.

Is there a way to achieve that?

thanks,  
Ehud

---

<div class="post-metadata">

**Author:** ![ehudros](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3ec8ea/32.png) [@ehudros](https://www.ruby-forum.com/u/ehudros)\
**Post date:** [April 19, 2007, 8:30pm UTC](https://www.ruby-forum.com/t/iterating-through-all-members-of-a-variable/92463/2 "2007-04-19T20:30:41Z")

</div>

> I’m looking for a way to run a white\_list helper on all fields returned  
> from a form. I want to do it in the controller (and not in the view),  
> and do not want to specify the field names but to it dynamically.
> 
> Is there a way to achieve that?

params.each\_pair do |k,v|  
…  
end

I would guess, but I haven’t tried it.
