# Disappearing decimals... please help!

**URL:** <https://www.ruby-forum.com/t/disappearing-decimals-please-help/121430>\
**Category:** Rails\
**Created:** [November 27, 2007, 10:15pm UTC](https://www.ruby-forum.com/t/disappearing-decimals-please-help/121430 "2007-11-27T22:15:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cade3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8dc957/32.png) [@cade3](https://www.ruby-forum.com/u/cade3)\
**Post date:** [November 27, 2007, 10:15pm UTC](https://www.ruby-forum.com/t/disappearing-decimals-please-help/121430/1 "2007-11-27T22:15:26Z")

</div>

Maybe it’s all in my head, but I’m having the strangest little issue  
ever. My pricetags in my rails app are always whole numbers. Rails seems  
to completely ignore my decimal input. So as a consequence, 10.41  
becomes 10.00, always.

Here’s some worthwhile stuff:

within my 004\_create\_products.rb file:

:price, :decimal, :percision =\> 2, :default =\> 0

And calling the product price in a view:

\<%= number\_to\_currency(product.price, {:precision =\> 2}) %\>

That’s all I can really think of that could be of help. Is this all in  
my head, or am I retarded and missing something?

---

<div class="post-metadata">

**Author:** ![cade3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8dc957/32.png) [@cade3](https://www.ruby-forum.com/u/cade3)\
**Post date:** [November 27, 2007, 10:22pm UTC](https://www.ruby-forum.com/t/disappearing-decimals-please-help/121430/2 "2007-11-27T22:22:08Z")

</div>

As stated in previous reply, make sure your migration is right. You  
can also verify the precision in the db tables.

–  
James M.

---

<div class="post-metadata">

**Author:** ![cade3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8dc957/32.png) [@cade3](https://www.ruby-forum.com/u/cade3)\
**Post date:** [November 27, 2007, 10:19pm UTC](https://www.ruby-forum.com/t/disappearing-decimals-please-help/121430/3 "2007-11-27T22:19:12Z")

</div>

I’m hoping that you just made a simple copy/paste error on that

> :price, :decimal, :percision =\> 2, :default =\> 0  
> ^^^

percision?

–  
James M.

---

<div class="post-metadata">

**Author:** ![cade3](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/8dc957/32.png) [@cade3](https://www.ruby-forum.com/u/cade3)\
**Post date:** [November 28, 2007, 10:08am UTC](https://www.ruby-forum.com/t/disappearing-decimals-please-help/121430/4 "2007-11-28T10:08:07Z")

</div>

On 11/27/07, Cade D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> :price, :decimal, :percision =\> 2, :default =\> 0

You’re asking for a column with two significant digits and don’t  
mention that you want decimal places.

Isak
