Nick Ginanto
Nick Ginanto

Reputation: 32120

Using update_attributes with column type of array

I have a languages column which is an array of strings with

add_column :table, :languages, :string, array: true, default: []

When I use update_attributes on that model, all columns are being updated except the languages column which remains []

Is there anything special needed to do here?

Upvotes: 2

Views: 681

Answers (1)

Ruby Racer
Ruby Racer

Reputation: 5740

When you post an array onto an action in the controller, you should permit like this:

params.require(:table).permit( {:languages => []}, :other_field, :other_field2... )

Upvotes: 1

Related Questions