I have a model Vote. Vote has an attribute vote_type. In my controller I do this
@vote = Vote.fetch(1)
logger.warn("current vote_type: #{@vote.vote_type}")
@vote.vote_type = false
@vote.save
This doesn’t throw any error but I see the following in my server
Vote Columns (0.7ms) SHOW FIELDS FROM `votes`
current vote_type: true
SQL (0.1ms) BEGIN
SQL (0.1ms) ROLLBACK
I have no idea why it is rolling back. What am i doing wrong?
If the field can ‘not have a value’ – which is what false is – then remove the required => true from the original migration and recreate that table/db (or create a new migration that removes the required setting).