Czech Collation on MS SQL Server 2005 (and maybe on other RDBMS) stores decimal number in following format "xxx,yy" where comma (,) is used as decimal point.
something like this is returned after load of this number from database:
=> #<Amount:0x4b7db40 @attributes={"value"=>"5000,77"}>
And calling method value on returned object causes:
a.value
=> 5000
Problem is that BigDecimal construtor stops their input on unknown character (comma in this case).
When I override instance_variable_set method in model class like this:
def instance_variable_set symbol, obj
super
if symbol == "@attributes"
input = obj["value"]
unless input.nil? or input.index(",").nil?
input[input.index(",")] = "."
@value = BigDecimal.new(input)
end
end
end
everything is OK. But this is not good solution. I preferred any solution in sqladapter, ActiveBase::Record or BigDecimal working with locales.