Active_record postgresql adapter problem


#1

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


#2

Jeremy K. wrote:

On Mar 1, 2006, at 9:19 AM, James B. wrote:

MONEY is deprecated. You work with it as a string, not a number.

Use NUMERIC instead.

Best,
jeremy

Done, Works, Thanks.

Jim


#3

On Mar 1, 2006, at 9:19 AM, James B. wrote:

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