Forum: Ruby on Rails Boolean with mysql as tinyint,but set true value as '-1'

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
C40341440de77fa93a1cc3b68a96a1e6?d=identicon&s=25 bumpspowdersteeps (Guest)
on 2007-03-26 20:53
(Received via mailing list)

We are developing a rails application, migrated from an Access front
end with sqlserver backend to a rails, mysql project, but we still
would like the Access front end to be able to connect to the mysql
database and use the application through both methods of connection.

Have converted the SQL servers boolean types to tinyint(1) for the
MySQL and rails,but turns out the old MS Access front end needs 'TRUE'
to be a value of '-1' in order for its checkboxes to work.  On the
MySQL we have set  0- for false, and 1 for True, which works great for
Rails out of the box, but...

Is there any way in a rails model declaration to have active record
store and understand '-1' as 'TRUE' rather than '1' as 'TRUE' ????


This topic is locked and can not be replied to.