I would like to create an enum field with sone migration, which I do, I tried searching on google but cannot find a way to do this in migration
The only thing I found is
t.column :status, :enum, :limit => [:accepted, :cancelled, :pending]
but it looks like the above code only works on rails 1.xxx, and since I am running rails 2.0
this is what i tried but it fails
class CreatePayments < ActiveRecord::Migration def self.up create_table :payments do |t| t.string :concept t.integer :user_id t.text :notes t.enum :status, :limit => [:accepted, :cancelled, :pending] t.timestamps end end def self.down drop_table :payments end end
So, if this is not allowed, what do you think might be a good solution? just a text box and confirmation from the model?
ruby ruby-on-rails migration
Gabriel Sosa Mar 29 '09 at 1:18 2009-03-29 01:18
source share