On 18 May 2016 at 08:51, Alessio Varalta <lists@ruby-forum.com> wrote:
> Hi, if I try params.inspect i see
>
> {"utf8"=>"✓",
>
> "authenticity_token"=>"RvpwQw/RdTAT2d4jtaSyBAYRgT1mKgWg9kyrS7pUnMo=",
> "person"=>{"birthplace"=>{"it"=>"Padova", "de"=>"Padovan"}},
> "commit"=>"Create Person", "action"=>"create", "controller"=>"people"}
>
>
> So I think is correct but in database i have
>
> --- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\nit: Padova\nde:
> Padovan\n
I have just realised what you are trying to do. Are you trying to
save a hash object in a field in the database? I have never done that
as almost always you are better to use models and associations for
storing the data. That is the Rails way. If you really need to do
that then google for how to save a hash in the database using rails,
for how to use serialisers to do it.
Colin
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuHhOxpEi08%2BvFAp6XuXXE_6%3Dqx6OCAZVzjTiXLCMBTPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment