In a Rails application using SQLite3 I'd like to use the float values Float::INFINITY and -Float::INFINITY in a model with a floating point attribute. Running INSERT queries using Model.create! this seems to work fine, since activerecord uses prepared statements in this case. However, when I try to update a record using foo.save, activerecord doesn't use a prepared stament and just puts the string Infinity right in the query, resulting in
SQLite3::SQLException: no such column: Infinity
Is there a way to work around this or do I need to resort to using strings in model/database?
Rails version 3.2.21, SQLite3 version 1.3.10
Edit. For now I changed the column type to string in the database migration and use
serialize :property, Float
to tell activerecord to store YAML-serialized floats in the database, allowing to store Float::INFINITY just fine.