Forum: Ruby on Rails Rails Recipes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Gene K. (Guest)
on 2006-04-23 05:25
Rails Recipes ... has got some very appetizing recipes. However, I have
a hard time starting. For example, the very first recipe,
InPlaceEditing, how and where do I run this code to create the table?

Thanks!

class AddContactsTable < ActiveRecord::Migration
  def self.up
    create_table :contacts do |t|
      t.column :name, :string
      t.column :email, :string
      t.column :phone, :string
      t.column :address_line1, :string
      t.column :address_line2, :string
      t.column :city, :string
      t.column :state, :string
      t.column :country, :string
      t.column :postal_code, :string
    end
  end

  def self.down
    drop_table :contacts
  end
end
Craig W. (Guest)
on 2006-04-23 05:36
(Received via mailing list)
On Sun, 2006-04-23 at 03:25 +0200, Gene K. wrote:
>       t.column :email, :string
>   def self.down
>     drop_table :contacts
>   end
> end
----
ruby script/generate migration name_of_migration

rake db:migrate

Craig
Gene K. (Guest)
on 2006-04-23 08:47
Thanks!

Craig W. wrote:
> On Sun, 2006-04-23 at 03:25 +0200, Gene K. wrote:
>>       t.column :email, :string
>>   def self.down
>>     drop_table :contacts
>>   end
>> end
> ----
> ruby script/generate migration name_of_migration
>
> rake db:migrate
>
> Craig
This topic is locked and can not be replied to.