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
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 J.
[email protected] wrote:
t.string :name, :null => false
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
To no avail:
== 20081023195916 CreateSampleForms: migrating
– create_table(:sample_forms)
-> 0.0610s
rake aborted!
undefined method `f_type=’ for #SampleForm:0x16856e3
rake aborted!
On Sun, Oct 26, 2008 at 11:37 AM, MaurÃcio Linhares <
Hi,
Rails doesn’t like the model name SampleForm.
I created a scaffold called Tent with the same attributes which does
work.
CmdJohnson
On Wed, Oct 29, 2008 at 7:15 PM, Commander J. <