If the machine isn't configured in english the connection will be stablished in that other language which breaks all .where(:date => Date.today) and similar commands because SQLServer starts to look for locale aware date format.
In my case
Devolucao.connection.user_options[:language]
returns "us_english" in my development machine and "Português" on my customer's server. On my machine '2010-12-24' is acceptable, on theirs it causes a out-of-range date conversion error. '24-12-2010' middle endian date otherwise is acceptable.
Easy way out is force the connection to use english, that should be done as soon the connection happens:
SET language 'us_english'
The better way would be to overload the :db conversion of Date::to_s to a locale sensible SQLServer compatible code.
PS: Error obtained
TinyTds::Error: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.:
If the machine isn't configured in english the connection will be stablished in that other language which breaks all .where(:date => Date.today) and similar commands because SQLServer starts to look for locale aware date format.
In my case
returns "us_english" in my development machine and "Português" on my customer's server. On my machine '2010-12-24' is acceptable, on theirs it causes a out-of-range date conversion error. '24-12-2010' middle endian date otherwise is acceptable.
Easy way out is force the connection to use english, that should be done as soon the connection happens:
The better way would be to overload the :db conversion of Date::to_s to a locale sensible SQLServer compatible code.
PS: Error obtained