if i have params like this :
params["scholarship"] = {"name"=>"test", "state_ids"=>["1", "2", "3", "4"]}
and when i create object to database field state_id not save to database?
how to save to database with format :
#<Scholarship id: 1, name: "test", state_id: "["1", "2", "3", "4"]">
how do that?
thanks before
Also you can use PostrgreSQL support for array storing. (If you're using PG of course). Your migration will look like that:
add_column :table_name, :column_name, :string, array: true, default: []
But don't forget about validations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With