# Migration fails when using certain table name

**URL:** <https://www.ruby-forum.com/t/migration-fails-when-using-certain-table-name/56279>\
**Category:** Rails\
**Created:** [March 29, 2006, 11:53pm UTC](https://www.ruby-forum.com/t/migration-fails-when-using-certain-table-name/56279 "2006-03-29T23:53:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomtoday](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/35a633/32.png) [@tomtoday](https://www.ruby-forum.com/u/tomtoday)\
**Post date:** [March 29, 2006, 11:53pm UTC](https://www.ruby-forum.com/t/migration-fails-when-using-certain-table-name/56279/1 "2006-03-29T23:53:15Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![tomtoday](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/35a633/32.png) [@tomtoday](https://www.ruby-forum.com/u/tomtoday)\
**Post date:** [March 29, 2006, 11:56pm UTC](https://www.ruby-forum.com/t/migration-fails-when-using-certain-table-name/56279/2 "2006-03-29T23:56:50Z")

</div>

Are you sure you defined a model named Section ?

---

<div class="post-metadata">

**Author:** ![tomtoday](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/35a633/32.png) [@tomtoday](https://www.ruby-forum.com/u/tomtoday)\
**Post date:** [March 30, 2006, 12:00am UTC](https://www.ruby-forum.com/t/migration-fails-when-using-certain-table-name/56279/3 "2006-03-30T00:00:53Z")

</div>

Christophe G. 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 🙂
