Last Updated: September 09, 2019
·
2.557K
· carlosepp

Update array values in rails

I am new to rails and I was trying to update array values this way:

model.some_array[0] = "new value"
model.save

I found out thanks to this issues #14763 and #6172 that
you need to tell rails that the array will change before you change its value like so:

model.some_array_will_change!

Hope you find this useful