logo       

Re: [Rails I18n] Globalize Currencies: msg#00005

lang.ruby.rails.i18n

Subject: Re: [Rails I18n] Globalize Currencies

Hi Kad,

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

Greetings,
Roland

Kad Kerforn 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


--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Railsi18n-discussion mailing list
Railsi18n-discussion@xxxxxxxxxxxxx
http://rubyforge.org/mailman/listinfo/railsi18n-discussion
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise