I created migration
add_column :users, :read_post_id, :integer
Added to the user model
serialize :read_post_id , Array
Edit: if I use
<%= User.find(current_user.id).read_post_id << 3 %>
I get an output [3]. But this value is only temporary and is not saved. How to save it ? I read Rails serialized integer attribute in params, but not saving into model instance which says serialized attributes cannot be integer. Changed it to text. After
<%= User.find(current_user.id).read_post_id << ["3","5"] %>
<%= User.find(current_user.id).read_post_id.count %>
<%= User.find(current_user.id).save %>
I do receive an ouput [["3", "5"]] 0 true
So basicly nothing has changed