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 -- Posted via http://www.ruby-forum.com/.
On Sun, 2006-04-23 at 03:25 +0200, Gene Kahn wrote:> 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---- ruby script/generate migration name_of_migration rake db:migrate Craig
Thanks! Craig White wrote:> On Sun, 2006-04-23 at 03:25 +0200, Gene Kahn wrote: >> t.column :email, :string >> def self.down >> drop_table :contacts >> end >> end > ---- > ruby script/generate migration name_of_migration > > rake db:migrate > > Craig-- Posted via http://www.ruby-forum.com/.