-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
Basically the type coercion on assignment is causing items that should not be valid to appear valid
class Company include Mongoid::Document field :revenue, type: Float validates_numericality_of :revenue end company = Company.new revenue: 'one million dollars' company.valid? # => true
The company is showing up as valid even though it is not, due to the model not responding to company.revenue_before_type_cast and the type cast on assignment forcing the string to 0.