From: bbiker Date: 2007-10-20T08:45:02+09:00 Subject: Re: why I can't update data, but I can insert data into new mode On Oct 19, 4:40 pm, OnRails Ruby wrote: > why I can't update data, but I can insert data into new model. > like this: > if File.find_by_id(id) > file=File.find_by_id(id) > else > file=File.new > > file.name=name > file.save > > there is a problem, when there don't find id, there is no problem, But > when find id, update the field, > there is Error, there said: undefined method 'name=' > why? who can help me? Thanks!! > -- > Posted viahttp://www.ruby-forum.com/. you did not define 'name' file.name = "name" file.save not tested