In Ruby 2.3.0, when I do rand.to_s[2..11].to_i to insert something multiple times in a loop in the ActiveRecord, which validates length: {maximum: 10, minimum: 10}. I got an error after some iteration that the length validation failed! And when I do rand(1e9...1e10).to_i in the same scenario, it solves the problem. I want to know what's the difference between these two.
Aucun commentaire:
Enregistrer un commentaire