-
Type: Improvement
-
Resolution: Won't Do
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: Attributes
-
None
Time/Date do not evolve into BigDecimal when querying. This is a very minor issue and unlikely to be encountered in real-world apps, but raising because I spotted it.
class Band
field :sales, type: BigDecmial
end
Band.create!(sales: BigDecimal(100))
Band.where(sales: Time.at(100)).count #=> 0 incorrect!
If you replace BigDecimal with Float or Integer in the above example, it works.
Possibly a bigger issue is that the #evolve method for BigDecimal does not appear to be handling respond to #to_d, or in the case of Date/Time, something like (.to_i + .usec).to_d would need to be called.