# Retreiving column values from a variable column name

**URL:** <https://www.ruby-forum.com/t/retreiving-column-values-from-a-variable-column-name/61676>\
**Category:** Ruby\
**Created:** [May 26, 2006, 1:26am UTC](https://www.ruby-forum.com/t/retreiving-column-values-from-a-variable-column-name/61676 "2006-05-26T01:26:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/958977/32.png) [@chris](https://www.ruby-forum.com/u/chris)\
**Post date:** [May 26, 2006, 1:26am UTC](https://www.ruby-forum.com/t/retreiving-column-values-from-a-variable-column-name/61676/1 "2006-05-26T01:26:03Z")

</div>

I need to retrieve a value from a column which I reference from a  
string, I cannot hardcode in the column name.

I would like something like this

text = shape.colour

however I am going to loop through a number of columns and the column  
specified after the (.) will be a variable or string.

for p in particulars  
text = shape.p  
end

I’ve seen you can use #{some\_string}, what exactly does this do to a  
string?

Thanks in advance
