If I have a Playlist model, how can I push arrays into a column?
#<Playlist id: 1, title: "This is a playlist", songs_ids: 1>
And want to push arrays to the songs_ids column what do I have to do?
This is how the songs_ids column look like
add_column :playlists, :songs_ids, :integer, array: true, default: []
I've tried updating the attributes and adding annother id of a song to it, but I have no luck with it either:
Playlist.find(1).update_attribute(songs_ids: [1, 2])
serialize :song_ids, ArrayinPlaylist.rbapidock.com/rails/ActiveRecord/Base/serialize/classsongs_idsis just anint. There are so many differences between MySQL and PostgreSQL that ActiveRecord will not help you with that developing on MySQL and deploying on PostgreSQL is madness. Develop and test with PostgreSQL if that's what you're deploying on. Rails/ActiveRecord doesn't offer any useful support for database portability beyond that absolute basics.