Frederick Cheung <rails-mailing-list@...> writes:
Chris Olsen wrote:
> Thanks for the help, but I don't think Ruby is a language that is
> sensitive to datatypes. I am new to the language, but I have not been
> able to find anything on the subject.
Ruby may not be statically typed, but that does not mean that 1 == "1"
(try it in irb) (and thus your code will not work if the id parameter
passed in is a string containing a number rather than the number itself.
It's ok with ActiveRecord::Base#find, but that's a different story.
Yeah, you're confusing dynamic typing (where you don't have to declare variable
types in the source code) with loose typing (where variable types are
automatically converted where needed).
Ruby can sort of support loose typing, but it relies on you doing the conversion
inside your own functions. Unfortunately, since that's not a universal
convention, you're unlikely to be able to guarantee other code works like that.