N00b question/issue

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 (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

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

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

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.

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?

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.

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:

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.

ok thanks

On Jan 6, 12:37 am, Daniel W. [email protected]