Variable + param

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,

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])

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! :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs