Trouble Inserting Array Into Postgres DB

Hi there,

I’m having difficulty inserting an array into a postgres db. I’m scoured the internet for help, tried many solutions, but am still having trouble. I’m using Rails 4.1.6

I have a pg database with the following migration:

add_column :dock_slip, :shore_power, :text, array:true, default: []


which appears in my schema like:

t.text    "shore_power",                                 default: [],    array: true


I am using a bootstrap multiselect from a form to produce array data. I get the param data in the format:

“shore_power”=>[“30 amp”, “50 amp”, “100 amp”]


In my model, I’m updating a bunch of attributes, including the above (missing some stuff…but like this). And saving of course:

slip.attributes = {shore_power: slip_data[‘shore_power’]}


This produces the following SQL statement - which seems incorrect to me. The data appears to be in the correct array format originally though:

SQL (0.5ms) UPDATE “dock_slips” SET “shore_power” = $1 WHERE “dock_slips”.“id” = 1 [[“shore_power”, “—\n- 30 amp\n- 50 amp\n- 100 amp\n”]]


Any input would be much appreciated. Thanks in advance.