# Error generating any scaffold

**URL:** <https://www.ruby-forum.com/t/error-generating-any-scaffold/70758>\
**Category:** Rails\
**Created:** [October 2, 2006, 6:39pm UTC](https://www.ruby-forum.com/t/error-generating-any-scaffold/70758 "2006-10-02T18:39:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![metrix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@metrix](https://www.ruby-forum.com/u/metrix)\
**Post date:** [October 2, 2006, 6:39pm UTC](https://www.ruby-forum.com/t/error-generating-any-scaffold/70758/1 "2006-10-02T18:39:36Z")

</div>

I have a problem with one Rails project and I can’t figure out why. I  
get the following error when any scaffold is generated:

The name ‘[model\_name]’ is reserved by Ruby on Rails.

So basically Rails complains that any model name I use is a reserved  
word. My model names are User, Invoice, InvoiceLineItem, Service and  
more…they aren’t reserved words.

The only significant difference between this project and the other is  
the version of rails. This project is on edge.

Has anyone had this happen before?

---

<div class="post-metadata">

**Author:** ![metrix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@metrix](https://www.ruby-forum.com/u/metrix)\
**Post date:** [October 2, 2006, 8:25pm UTC](https://www.ruby-forum.com/t/error-generating-any-scaffold/70758/2 "2006-10-02T20:25:58Z")

</div>

I just thought to run a trace and found our there is a class collision  
happening when generating a scaffold. Why would there be a class  
collision?

I also found scaffolds can be generated for very simple models. However  
virtually any model that has a belongs\_to relationship can’t have a  
scaffold generated.

Just to simplyfy things I commented out all relationships from the  
models, but the scaffolds still can’t be generated. I think this happens  
because rails is actually looking at my database and not the model when  
generating the scaffold (how else would it kno whot to bind the HTML  
inputs?), and it spots “forgeign key” fields and chokes. Is this true?

I’m new to rails and not sure exactly what I should do. Any suggestions?

I know scaffolds aren’t the be-all-end-all but I was hoping to save some  
time by by using them as a starting point. My application is very  
CRUD-like and would only need minimal changes.

---

<div class="post-metadata">

**Author:** ![metrix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@metrix](https://www.ruby-forum.com/u/metrix)\
**Post date:** [October 2, 2006, 8:55pm UTC](https://www.ruby-forum.com/t/error-generating-any-scaffold/70758/3 "2006-10-02T20:55:54Z")

</div>

Ok…just to keep anyone in the same boat updated…I went through and  
deleted all foreign key columns in the database. I did this to force a  
really simple table/model. Generate scaffold still fails. Rails just  
doesn’t want to create scaffolds for the majority of my models.

---

<div class="post-metadata">

**Author:** ![metrix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@metrix](https://www.ruby-forum.com/u/metrix)\
**Post date:** [October 3, 2006, 8:16pm UTC](https://www.ruby-forum.com/t/error-generating-any-scaffold/70758/4 "2006-10-03T20:16:49Z")

</div>

Just to keep anyone in this same situation updated…

Watch our for Observers and enerate Scaffold. If you have an Observer  
attached to any of your Models, Rails will throw a raise a class  
collission error if you try and generate a scaffold on that model.

It’s not an obvious error and you’ll spend hours trying to figure out  
where the problem is.

Solution: Remove your observer, genrerate the scaffold, add observer  
back in.

---

<div class="post-metadata">

**Author:** ![metrix](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@metrix](https://www.ruby-forum.com/u/metrix)\
**Post date:** [October 3, 2006, 8:56pm UTC](https://www.ruby-forum.com/t/error-generating-any-scaffold/70758/5 "2006-10-03T20:56:36Z")

</div>

On 10/3/06, Brandon C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Solution: Remove your observer, genrerate the scaffold, add observer  
> back in.

Great catch, Brandon. Would you open a ticket for this issue?  
[http://dev.rubyonrails.org/newticket](http://dev.rubyonrails.org/newticket)

Thanks,  
jeremy
