From: deal bitte Date: 2012-07-17T21:08:54+09:00 Subject: Re: undefined method error Exactly. Sorry that i had not posted my question properly. So I shall try putting the code below The column names and the value to insert in the columns are both in arrays :):) rid.send(database_columns[0],data_save_array[0]) Thank you so much for the help Jan E. wrote in post #1069041: > OK, I see what you mean. You want to use the values of > "database_columns" as method names. > > However, you cannot simply write ".database_columns[0]". This will be > interpreted as calling the method "database_columns". You have to use > "send" or "public_send", which allows you to pass the method name as a > string: > > rid.send(database_columns[0], '(value to insert for this column)') > > > By the way, forget what I said about calling "database_columns". This is > of course a variable and not a method (which we couldn't tell from your > first post) -- Posted via http://www.ruby-forum.com/.