# Globalize Currencies

**URL:** <https://www.ruby-forum.com/t/globalize-currencies/96906>\
**Category:** Rails I18n\
**Created:** [July 3, 2006, 10:22am UTC](https://www.ruby-forum.com/t/globalize-currencies/96906 "2006-07-03T10:22:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [July 3, 2006, 10:22am UTC](https://www.ruby-forum.com/t/globalize-currencies/96906/1 "2006-07-03T10:22:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kadoudal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f0a364/32.png) [@kadoudal](https://www.ruby-forum.com/u/kadoudal)\
**Post date:** [July 3, 2006, 1:43pm UTC](https://www.ruby-forum.com/t/globalize-currencies/96906/2 "2006-07-03T13:43:03Z")

</div>

Hi Kad,

this is exactly what i patched, read the other thread 🙂

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
