# N00b question/issue

**URL:** <https://www.ruby-forum.com/t/n00b-question-issue/125146>\
**Category:** Rails\
**Created:** [January 6, 2008, 7:12am UTC](https://www.ruby-forum.com/t/n00b-question-issue/125146 "2008-01-06T07:12:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [January 6, 2008, 7:12am UTC](https://www.ruby-forum.com/t/n00b-question-issue/125146/1 "2008-01-06T07:12:33Z")

</div>

i know this is n00b but i have searched and i can not figure it out.  
i am running instantrails on windows. i downloaded ajax\_scaffold and  
installed using script/generate in a new rails project. after  
configing the db i can the following error when trying to access  
[http://localhost:3001/invoices/list](http://localhost:3001/invoices/list) (invoices is the controller/table  
i built ajax\_scaffold on)…

NameError in InvoicesController#component

uninitialized constant Invoice

RAILS\_ROOT: C:/INSTAN~1/rails\_apps/mocerinotech/config/…

thanks

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [January 6, 2008, 7:21am UTC](https://www.ruby-forum.com/t/n00b-question-issue/125146/2 "2008-01-06T07:21:07Z")

</div>

joe wrote:

> NameError in InvoicesController#component
> 
> uninitialized constant Invoice

Probably means you’re referencing the Invoice class without having  
created it. Do you have an Invoice model in app/models? Check there  
first. If you don’t have it, generate it via the command line with:

ruby script/generate model invoice

You’ll need to edit the migration file created for that model (in  
db/migrate), then run:

rake db:migrate

Try those things and let us know how it turns out.

- Daniel

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [January 6, 2008, 7:26am UTC](https://www.ruby-forum.com/t/n00b-question-issue/125146/3 "2008-01-06T07:26:04Z")

</div>

i have the model created and contains:

require ‘ajax\_scaffold’

class Invoices \< ActiveRecord::Base

end

i tried the rake db:migrate and i get the same error

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [January 6, 2008, 7:28am UTC](https://www.ruby-forum.com/t/n00b-question-issue/125146/4 "2008-01-06T07:28:57Z")

</div>

joe wrote:

> i have the model created and contains:
> 
> require ‘ajax\_scaffold’
> 
> class Invoices \< ActiveRecord::Base
> 
> end
> 
> i tried the rake db:migrate and i get the same error

Also, if that is your EXACT code, the problem might be there. Typically  
Rails model classes are singular, so Invoice instead of Invoices. I’d  
still shoot for ActiveScaffold though.

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [January 6, 2008, 7:34am UTC](https://www.ruby-forum.com/t/n00b-question-issue/125146/5 "2008-01-06T07:34:50Z")

</div>

yeah i read about that but when i try activeScaffold i get this error:

NoMethodError in InvoicesController#list

undefined method `active\_scaffold’ for InvoicesController:Class

so i was trying to get it to work in the older version first but i  
would rather use activeScaffold. the error above doesnt like the  
following line i added to my controller class:  
active\_scaffold :Invoice

any ideas?

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [January 6, 2008, 7:37am UTC](https://www.ruby-forum.com/t/n00b-question-issue/125146/6 "2008-01-06T07:37:59Z")

</div>

joe wrote:

> yeah i read about that but when i try activeScaffold i get this error:
> 
> NoMethodError in InvoicesController#list
> 
> undefined method `active\_scaffold’ for InvoicesController:Class
> 
> so i was trying to get it to work in the older version first but i  
> would rather use activeScaffold. the error above doesnt like the  
> following line i added to my controller class:  
> active\_scaffold :Invoice
> 
> any ideas?

Based on your errors it sounds like something isn’t being included  
properly. Undefined method is pretty obvious – active\_scaffold isn’t a  
defined method.

Double-check with the AS documentation on how and where to include what.  
Since I have no experience with AS I can’t help you beyond that.

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [January 6, 2008, 7:27am UTC](https://www.ruby-forum.com/t/n00b-question-issue/125146/7 "2008-01-06T07:27:44Z")

</div>

joe wrote:

> i have the model created and contains:
> 
> require ‘ajax\_scaffold’
> 
> class Invoices \< ActiveRecord::Base
> 
> end
> 
> i tried the rake db:migrate and i get the same error

Hmm… a quick search on Google revealed that AjaxScaffold has been  
deprecated in favor of ActiveScaffold. Try this first:

> **[噂のUR賃貸事情 |](http://www.activescaffold.com/)**
>
> UR賃貸住宅は、子連れ家族に人気があります。 1つは、間取りに対する専有面積が広いところです。将来的に家族が増えても安心ですよ。次に、安全性の高い子供達の共有空間がある点です。最後は、緑溢れる豊かな自然環境があるところです。子供達がのびのびと成長していける空間が、UR賃貸住宅には沢山あります。

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [January 24, 2008, 9:30pm UTC](https://www.ruby-forum.com/t/n00b-question-issue/125146/8 "2008-01-24T21:30:00Z")

</div>

couple thoughts:

1. that model should be singular - tables are plural - I would imagine  
it’s double important when you start relying on ORM in Rails
2. even though its probably better to use the newer activescaffold,  
ajaxscaffold should still work - deprication shouldnt be killing it
3. when you say ‘config the db’ after generating as - that may have  
complicated things. I have had these same types of errors and noticed  
when I went back and created a new project clean and tried again they  
went away.

---

<div class="post-metadata">

**Author:** ![joe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9e5f3/32.png) [@joe](https://www.ruby-forum.com/u/joe)\
**Post date:** [January 6, 2008, 8:08am UTC](https://www.ruby-forum.com/t/n00b-question-issue/125146/9 "2008-01-06T08:08:08Z")

</div>

ok thanks

On Jan 6, 12:37 am, Daniel W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
