# Alternative to :decimal column type for migrations?

**URL:** <https://www.ruby-forum.com/t/alternative-to-decimal-column-type-for-migrations/69295>\
**Category:** Rails\
**Created:** [September 20, 2006, 1:49am UTC](https://www.ruby-forum.com/t/alternative-to-decimal-column-type-for-migrations/69295 "2006-09-20T01:49:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_JSBott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@Christopher\_JSBott](https://www.ruby-forum.com/u/Christopher_JSBott)\
**Post date:** [September 20, 2006, 1:49am UTC](https://www.ruby-forum.com/t/alternative-to-decimal-column-type-for-migrations/69295/1 "2006-09-20T01:49:29Z")

</div>

Hi,  
I’m reading Agile Web D. 2nd Edition and I’m following along  
by doing the sample application ‘depot’ on my Linux machine. In one of  
their migrate scripts, they use the following line of code:  
add\_column :products, :price, :decimal, :precision =\> 8, :scale =\> 2,  
:default =\> 0

They note in the book that :decimal won’t exist as a column type until  
Rails 1.2… which isn’t installed on my machine. What is the  
alternative, pre Rails 1.2 syntax for making a decimal column with  
precision 8 and scale 2?

Thank you,  
– C

---

<div class="post-metadata">

**Author:** ![Christopher\_JSBott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@Christopher\_JSBott](https://www.ruby-forum.com/u/Christopher_JSBott)\
**Post date:** [September 20, 2006, 3:19am UTC](https://www.ruby-forum.com/t/alternative-to-decimal-column-type-for-migrations/69295/2 "2006-09-20T03:19:36Z")

</div>

Drop tp SQL with execute.

On 9/19/06, Christopher J. Bottaro [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> alternative, pre Rails 1.2 syntax for making a decimal column with  
> precision 8 and scale 2?
> 
> Thank you,  
> – C
> 
> >

–  
When a man says he approves of something in principle, it means he  
hasn’t the slightest intention of putting it into practice. –  
Bismarck

---

<div class="post-metadata">

**Author:** ![Christopher\_JSBott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@Christopher\_JSBott](https://www.ruby-forum.com/u/Christopher_JSBott)\
**Post date:** [September 20, 2006, 9:58am UTC](https://www.ruby-forum.com/t/alternative-to-decimal-column-type-for-migrations/69295/3 "2006-09-20T09:58:05Z")

</div>

On 9/20/06, Michael C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Drop tp SQL with execute.

Or upgrade to edge.

Isak

---

<div class="post-metadata">

**Author:** ![Christopher\_JSBott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@Christopher\_JSBott](https://www.ruby-forum.com/u/Christopher_JSBott)\
**Post date:** [September 20, 2006, 5:01pm UTC](https://www.ruby-forum.com/t/alternative-to-decimal-column-type-for-migrations/69295/4 "2006-09-20T17:01:00Z")

</div>

Thanks, that worked… 🙂

–C
