From: MonkeeSage Date: 2007-11-27T22:54:59+09:00 Subject: Re: how to change all values for object On Nov 27, 5:48 am, Bober wrote: > Hello! > I need change all values of Active Record Object > > // Post - obiekt AR > > @invo = Post.find(params[:id]) > @a = @invo.attributes > > @a.each { |m, n| > @invo.m = "new_value" > > } > > But, I see "undefined method `m=' " > > what is wrong? > how can I change values? From the docs... http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M001069 ...it appears that @a would be a Hash. If that is correct, you have to use the subscript operator (or #store) to change the items... @invo = Post.find(params[:id]) @a = @invo.attributes @a.each { |m, n| @invo[m] = "new_value" # ^^^ } Look at the ruby documentation for the Hash class... http://www.ruby-doc.org/core/classes/Hash.html Regards, Jordan