Simpel question (scaffold?) :(


#1

Hello their,

Its very simple, here is my code:

class BlogController < ActionController::Base
scaffold :blogs
end

When I go to
http://127.0.0.1:3000/blog/list/

I get this error:
uninitialized constant Blog

The table exist (blogs), but it doesn’t allow me to use the default
scaffold interface, why?

Please any help, thanks :slight_smile:

Regards,
Jamal


#2

Just scaffold :blog, not :blogs


#3

Guest wrote:

Just scaffold :blog, not :blogs

Thanks for answering me so fast :smiley:

I just tried this, and still the error message didn’t change :frowning: ?


#4

Jamal S. wrote:

Hello their,

Its very simple, here is my code:

class BlogController < ActionController::Base
scaffold :blogs
end

When I go to
http://127.0.0.1:3000/blog/list/

I get this error:
uninitialized constant Blog

The table exist (blogs), but it doesn’t allow me to use the default
scaffold interface, why?

Please any help, thanks :slight_smile:

Regards,
Jamal

I get it to work, if you had the same error, then you must remember that
to set the table name in a model.

ruby script/generate model blog

then open the file blog.rb
class Blog < ActiveRecord::Base
set_table_name “blogs”
end

then go back to your controller:
class BlogController < ApplicationController
scaffold :blog;

end

Everything work :smiley:

-Never give up!