Answer the question
In order to leave comments, you need to log in
[Rails] How to properly update postgresql array?
There is an array field in the postgresql table: t.string :favorits, array: true, default: []
From time to time I need to add and remove elements from this field:
@user.favorits.delete_at("has_value")
@user.favorits.unshift("new_value")
@user.save
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question