***** I wanted to know if it is possible to achieve what I would like
to do
as the first solution is impossible to do for various reasons
****
well there's always read_attribute (and remember that
foo.read_attribute(:bar) is the same as foo[:bar] )
Fred
I think rather than doing read_attribute, you should do
def get_value_for_column(attribute)
send(attribute)
end
because if you have
def something
read_attribute(:first) + read_attribute(:second)
end
then get_value_for_column("something") would not work in case of read_attribute in get_value_for_column
-Arpit Jain
Anthony Ward wrote:
I think rather than doing read_attribute, you should do
def get_value_for_column(attribute)
send(attribute)
end
Sort of depends what problem you are trying to use (eg send won't work
if you had a legacy schema with a column name that isn't a legal name
for a ruby method).
Fred
yeah you are right. Thanks for clarifying 
Frederick Cheung wrote:
I think rather than doing read_attribute, you should do
def get_value_for_column(attribute)
send(attribute)
end
Sort of depends what problem you are trying to use (eg send won't work
if you had a legacy schema with a column name that isn't a legal name
for a ruby method).
s/isn\'t/is