Globalize Currencies

I am quite there …

in creating the price , from the form pots, I should have written :
@product = Product.new(@params[:product])
@product.price = Currency.parse(@product[:lp])

-> gives me the correct price in DB

when updating …

@product.price.format # ->will display the correct string in
the text field

BUT, if I update the value in the form , “150,00 â?¬” will give
1500000 cents !!! (incredible way to make money I agree…)

irb(#AdminController:0x24c2ccc):001:0> @p1.inspect =>
““150,00 â?¬””
irb(#AdminController:0x24c2ccc):002:0> p = Currency.parse(@p1) =>
#<Globalize::Currency:0x240c4f4 @cents=1500000>

what’s wrong with the parse in this case ?

kad

Hi Kad,

this is exactly what i patched, read the other thread :slight_smile:

Greetings,
Roland

Kad K. wrote:

I am quite there …

in creating the price , from the form pots, I should have written :
@product = Product.new(@params[:product])
@product.price = Currency.parse(@product[:lp])

-> gives me the correct price in DB

when updating …

@product.price.format # ->will display the correct string in
the text field

BUT, if I update the value in the form , “150,00 â?¬” will give
1500000 cents !!! (incredible way to make money I agree…)

irb(#AdminController:0x24c2ccc):001:0> @p1.inspect =>
““150,00 â?¬””
irb(#AdminController:0x24c2ccc):002:0> p = Currency.parse(@p1) =>
#<Globalize::Currency:0x240c4f4 @cents=1500000>

what’s wrong with the parse in this case ?

kad