From: "Collins, Justin" Date: 2006-10-06T18:43:24+09:00 Subject: Re: RoR : Shortening this code ------_=_NextPart_001_01C6E92B.DCD2A216 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Zouplaz wrote: > Hello, > > Under Ruby On Rails, I would like to replace > > mouvement =3D Mouvement.find(params[:id]) > mouvement.statut =3D :traite > mouvement.save! > > By > > Mouvement.update(params[:id], statut =3D'#{:traite}'") > > But this error occurs : undefined method `stringify_keys!' for "statut = =3D traite":String > > > I don't understand the meaning of the error. Why does Ruby doesn't = knows how to convert the symbol :traite to a string representation ? > > Even statut =3D'#{:traite.to_s}'" don't work > > Any help ? > > Thank you > I can't tell you exactly, but I can give you a hint. It is converting = :traite to a string. But, you have a mistype somewhere, because you have = an uneven number of double quotes. I'm guessing that when you = pasted/wrote the code in your email, this was obscured. > Mouvement.update(params[:id], statut =3D'#{:traite}'") ^ ^^ You even have it again: > Even statut =3D'#{:traite.to_s}'" don't work ^ ^^ Hope that helps. -Justin ------_=_NextPart_001_01C6E92B.DCD2A216--