Try this:
class CreateSampleForms < ActiveRecord::Migration
def self.add_data
SampleForm.create(:name => 'Default (Empty)', :f_type => 'Default
(Empty)', :description => 'Use this template to create a blank form.')
end
def self.up
create_table :sample_forms do |t|
t.string :name, :null => false
t.string :f_title
t.text :description
t.timestamps
end
SampleForm.reset_column_information
self.add_data
end
def self.down
drop_table :sample_forms
end
end
On Sun, Oct 26, 2008 at 7:11 AM, Commander Johnson
<[EMAIL PROTECTED]> wrote:
> Hi,
> This is my migration:
> class CreateSampleForms < ActiveRecord::Migration
> def self.add_data
> SampleForm.create(:name => 'Default (Empty)', :f_type => 'Default
> (Empty)', :description => 'Use this template to create a blank form.')
> end
>
> def self.up
> create_table :sample_forms do |t|
> t.string :name, :null => false
> t.string :f_title
> t.text :description
> t.timestamps
> end
>
> self.add_data
> end
> def self.down
> drop_table :sample_forms
> end
> end
> While migrating, it gives the error 'undefined method f_title='. I first
> thought 'title' was reserved so I renamed it to 'f_title'. When I remove it,
> the process starts over with the description attribute.
> CmdJohnson
> >
>
--
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)
João Pessoa, PB, +55 83 8867-7208
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---