Ok so could anyone tell me what this is called so I can look it up
rather posting questions in this forum all the time. I have had to post
something to learn how to do the following:
Model.send("field#{x}")
and
session["field#{x}".to_sym]
now I am trying to do this for variables for example:
@details = RDetails.find(id)
1.upto(15) do |x|
@details.???("field#{x}")
end
@details.save
I don't even know what to look up. I tried string methods, model
methods, variable methods...
Ok so could anyone tell me what this is called so I can look it up
rather posting questions in this forum all the time. I have had to post
something to learn how to do the following:
Model.send("field#{x}")
and
session["field#{x}".to_sym]
now I am trying to do this for variables for example:
@details = RDetails.find(id)
1.upto(15) do |x|
@details.???("field#{x}")
end
@details.save
I don't even know what to look up. I tried string methods, model
methods, variable methods...
What are you trying to do there? Set those fields? Otherwise I doin't see what the point is... I'm thinking you maybe want:
@details.send("field#{x}=", "some val here")
That would set all those fields to "some val here".
And what you said works perfect, that's exactly what I was trying to do.
I understood what the .send was doing before, I didn't realize I could
also use that to set the values as well using: