Re: Help with serialization

Frederick Cheung
Mon, 23 May 2011 13:41:22 -0000

On May 23, 12:23 pm, QAS WM
<li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>
wrote:
> in my migration is have:
>
>      t.string   :options
>
> in my model i have:
>
>      serialize :options
>
> in my controller create and update I am doing the following:
>
>   @vehicle.options = {:ac_front => params[:ac_front],
>     :ac_rear => params[:ac_rear],
>     :air_bag_driver => params[:air_bag_driver],
>     :air_bag_passenger => params[:air_bag_passenger],
>     :air_bag_side => params[:air_bag_side],
>     :alloy_wheels => params[:alloy_wheels] }
>
> where all the params being passed are boolean true or false values.
>

So what does get saved in the database. What does the params hash look
like at the point where this code runs?

Fred

> But for some reasons the values of the params do not get saved in the
> db. What am i doing wrong?
>
> --
> Posted viahttp://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.