-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
I am using a Numericality Validator on an Integer field. But the validator does not work as expected, I am able to save a String. In this case it will be typecasted to 0.
class Log include Mongoid::Document include Mongoid::Timestamps field :user_id, type: Integer field :user_agent, type: String field :url, type: String validates_numericality_of :user_id, :only_integer => true end
@log.user_id = 'abc' @log.valid? # true @log.user_id == 0 # true
I am using Mongoid 3.0.0.rc.
Maybe this issue relates to MONGOID-1736 ?