Hi all, I made this array: @army_types = ["ss","s","xl","l","m","w","xw"] but, I want to be able to go like this @army_types.each do |st| @user.st end but, I get the error that "@user.st" st is not a valid feild for the table user. Is there a way to get around MySQL running it first?
on 2006-05-09 00:11
on 2006-05-09 00:18
It's not entirely clear to my what you want to do. But if I understand correctly, you should try this: @army_types.each do |st| @user.send(st) end
on 2006-05-09 00:31
Carl-Johan K. wrote: > It's not entirely clear to my what you want to do. But if I understand > correctly, you should try this: > > @army_types.each do |st| > @user.send(st) > end Thanks this worked