Instead of using numeric I created the field "unit_price" as PostgreSQL type money. Now when I try and add a row I get the following. How do I override AR default behaviour to cast numeric post data to money, or am I forced to only support database types that active_record knows about? RuntimeError: ERROR C42804 Mcolumn "unit_price" is of type money but expression is of type numeric HYou will need to rewrite or cast the expression. Fparse_target.c L361 RupdateTargetListEntry: INSERT INTO line_items ("order_id", "product_id", "quantity", "unit_price") VALUES(1, 3, 1.0, 5367829.95) Regards, Jim -- Posted via http://www.ruby-forum.com/.
On Mar 1, 2006, at 9:19 AM, James Byrne wrote:> Instead of using numeric I created the field "unit_price" as > PostgreSQL > type money. Now when I try and add a row I get the following. How > do I > override AR default behaviour to cast numeric post data to money, > or am > I forced to only support database types that active_record knows > about? > > RuntimeError: ERROR C42804 Mcolumn "unit_price" is of type money but > expression is of type numeric HYou will need to rewrite or cast the > expression. Fparse_target.c L361 RupdateTargetListEntry: INSERT INTO > line_items ("order_id", "product_id", "quantity", "unit_price") > VALUES(1, 3, 1.0, 5367829.95)MONEY is deprecated. You work with it as a string, not a number. Use NUMERIC instead. Best, jeremy
Jeremy Kemper wrote:> On Mar 1, 2006, at 9:19 AM, James Byrne wrote:> MONEY is deprecated. You work with it as a string, not a number. > > Use NUMERIC instead. > > Best, > jeremyDone, Works, Thanks. Jim -- Posted via http://www.ruby-forum.com/.