Decimal Columns Allow Defaults?

Is :default allowed as an option for decimal columns?

A migration:
class CreateMoney < ActiveRecord::Migration
def self.up
create_table :money do |t|
t.decimal :amount, :defaut => 0.0, :precision => 8, :scale => 2
end
end

def self.down
drop_table :money
end
end

Creates the following schema:

create_table “money”, :force => true do |t|
t.decimal “amount”, :precision => 8, :scale => 2
end

What happened to the default, it’s gone!

Bug? or do decimal columns disallow the :default option? or is it
because :precision/:scale are also set?

You’re missing an “l” in “default”.

Damn.

On Feb 10, 2011, at 1:54 PM, Karl S. wrote:

def self.down
What happened to the default, it’s gone!

Bug? or do decimal columns disallow the :default option? or is it
because :precision/:scale are also set?

defaut != default

You’ve got a typo.