On Monday, December 2, 2013 12:23:34 AM UTC-8, Giovanni Gervasio wrote: > Sorry if this is a trivial question. > > I have a table in SQL server thus: > > CREATE TABLE widgets > ( > id INT Identity(1, 1) PRIMARY KEY, > name VARCHAR(12), > cost MONEY > ) > > SELECT * FROM widgets > > id name cost > ----------- ------------ --------------------- > 1 compass 74.9900 > 2 hat 49.9900 > 3 book 19.9900 > > > and a Widget class > > class Widget < Sequel::Model > end > > Contrary to my expectations, Widget.cost has class String'. > > Widget[1].cost + Widget[2].cost > => "74.990049.9900" > > To perform any arithmetics I have to convert 'cost' explicitly to a > numeric type. I am sure that there is a way to have the model store and > return a BigDecimal, or another numeric type, but I could not find it. >
Which adapter are you using? If you are using the tinytds adapter, Sequel relies on tiny_tds to do the conversion, so in that case you need to talk to the tiny_tds developers. For models, you may be able to work around this using the typecast_on_load plugin. Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/groups/opt_out.
