# Variable + param

**URL:** <https://www.ruby-forum.com/t/variable-param/115421>\
**Category:** Rails\
**Created:** [September 25, 2007, 4:08am UTC](https://www.ruby-forum.com/t/variable-param/115421 "2007-09-25T04:08:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [September 25, 2007, 4:08am UTC](https://www.ruby-forum.com/t/variable-param/115421/1 "2007-09-25T04:08:19Z")

</div>

Hello i am iterating over one record: it schema is:

id, name, content, content2, content3 and so on

i tried to do with other table to normalize it but ok,

the thing is that n the view to move to other content i send a  
param[:page] =\> :content2 or 3 or 4

in the controller i am trying to do this:

def section  
…  
@section."#{param[:page]}"  
…  
end

how can i do to combine an object with a param, or other idea how to  
move on records like this?

Regars,

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [September 25, 2007, 4:22am UTC](https://www.ruby-forum.com/t/variable-param/115421/2 "2007-09-25T04:22:59Z")

</div>

> in the controller i am trying to do this:
> 
> def section  
> …  
> @section."#{param[:page]}"  
> …  
> end
> 
> how can i do to combine an object with a param, or other idea how to  
> move on records like this?

@section.send(param[:page])

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [September 25, 2007, 4:36am UTC](https://www.ruby-forum.com/t/variable-param/115421/3 "2007-09-25T04:36:54Z")

</div>

Philip H. wrote:

> > in the controller i am trying to do this:
> > 
> > def section  
> > …  
> > @section."#{param[:page]}"  
> > …  
> > end
> > 
> > how can i do to combine an object with a param, or other idea how to  
> > move on records like this?
> 
> @section.send(param[:page])

Thanks Philip! 🙂
