I'm trying to do this migration, but it fails when I try to create a default content using Section.create I get an error saying 'unitialized contant Section' The weird thing is if I use a table name like 'categories' with Category.create instead of 'sections' and Section.create then it all works fine! I'm working from Rails 1.1 This is an example migration that fails: ===== class InitialSetup < ActiveRecord::Migration def self.up # Page sections table create_table :sections do |t| t.column "title", :string, :limit => 60 t.column "link", :string, :limit => 60 t.column "page_title", :string t.column "keywords", :string end # Default content Section.create :title => "Home", :link => "home" end def self.down drop_table :sections end end ====== Error: 'unitialized contant Section'. But use create_table :categories and Category.create and it all works. Am I missing something glaringly obvious here?
on 2006-03-29 23:53
on 2006-03-29 23:56
Are you sure you defined a model named Section ?
on 2006-03-30 00:00
Christophe Gimenez wrote: > Are you sure you defined a model named Section ? Doh! Thanks Christophe, as you can see I'm very new to this! I had a category controller, but forgot to rename it to section when I decided to rename the DB table. Cheers :)