how to save array to database in rails

前端 未结 4 851
我在风中等你
我在风中等你 2020-12-10 01:07

if i have params like this :

params[\"scholarship\"] = {\"name\"=>\"test\", \"state_ids\"=>[\"1\", \"2\", \"3\", \"4\"]}

and when i c

4条回答
  •  悲哀的现实
    2020-12-10 01:15

    In your model have

    serialize :state_ids
    

    Here is a link to the documentation

    That being said it looks like you're trying to pass state_ids parameters and save it in state_id, is this what you're intending to do?

提交回复
热议问题