Today on my ruby travels, I realised that .to_i
assumes a little too much:
"3a0a459e-7ca2-4648-ba80-dc6507f7d771".to_i
=> 3
As you can see, to_i
has made some pretty wild assumptions about what it thinks you wanted, and has selected the first char from the string that is a valid integer.
In the end I used Integer()
to ensure that everything was peachy.
Happy coding all!