Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails Active Admin PUT not updating boolean values (SQL Server)

I switched to SQL Server on production, and realized that Active Admin PUT calls aren't updating some boolean values in my database. The PUT calls will return a 302, and not update the record even though I can see that the parameter is being sent in exactly as expected. For example if a boolean was set to false, and I wanted to set it as true, Active Admin would correctly send the values in as value => true, but it will not update.

One thing I noticed that is funny, is that on heroku where we run our tests, the values for these fields will update just fine in Active Admin. On production, where SQL Server is used, the values show as 1 and 0, not as true or false. I have a feeling this is part of the issues.

My question is, why would only some of the booleans show up as 1 and 0 on SQL SERVER, and on heroku and mySQL show up as true or false? How can I fix these values to make the show true and false, rather than 1 and 0?

More information. Updating these values via rails console, and in the application, work just fine. I can say model.field = true then model.save in all environments successfully.

like image 233
botbot Avatar asked Oct 04 '22 03:10

botbot


1 Answers

I was having exactly the same issue at heroku. For me, i had to restart my app after running migrations.

like image 63
Nadeem Yasin Avatar answered Oct 13 '22 10:10

Nadeem Yasin