Rails Active Admin PUT Does Not Update Booleans (SQL Server)

I switched to SQL Server for production and realized that Active Admin PUT calls did not update some booleans in my database. PUT calls will return 302 and will not update the record, although I can see that the parameter is sent exactly as expected. For example, if boolean was set to false, and I wanted to set it to true, Active Admin correctly sent the values ​​as => true, but it will not be updated.

One thing that I noticed is funny, is that on the hero where we run our tests, the values ​​for these fields will be updated in Active Admin. In production using SQL Server, values ​​are displayed as 1 and 0, and not as true or false. I have a feeling that this is part of the problem.

My question is why only some of the logical lines are displayed as 1 and 0 in SQL SERVER, and on heroku and mySQL are displayed as true or false? How can I correct these values ​​to show true and false, rather than 1 and 0?

Additional Information. Updating these values ​​using the rails console and in the application works very well. I can say that model.field = true, and then model.save in all environments is successful.

+4
source share
2 answers

I had the same problem as you, it can be solved by adding a logical field to the resolution settings.

+1
source

The hero had exactly the same problem. For me, I had to restart the application after the migration.

0
source

Source: https://habr.com/ru/post/1480833/


All Articles