Hi im having problems using scaffolds. Im trying to do something very simple, I dont understand the error. Hopefully someone can advise me.
1. I've created my project, set my databases as SQLight and ran the migration: ruby script/generate migration add_a_new_table
2. I have then edited the code in db/migrate/001_add_a_new_table to:
class AddANewTable < ActiveRecord::Migration
def self.up create_table :users do |table| table.column :name, :string table.column :address, :string table.column :postcode, :string table.column :country, :string table.column :phone, :string table.column :email, :string
end end
def self.down drop_table :users end end
3. Then I have: rake migrate
4. When I run: script/generate scaffold users It seems to work and builds to scaffold. However when i try to view the page: http://localhost:3002/users
It displays this: NameError in UsersController#index
uninitialized constant User RAILS_ROOT: /Users/jim/Documents/work/scaffolds/config/..
Application Trace | Framework Trace | Full Trace /Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/ i386/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/ dependencies.rb:123:in `const_missing' /Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/ i386/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/ dependencies.rb:131:in `const_missing' /Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/ i386/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/ inflector.rb:161:in `constantize' /Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/ i386/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/ core_ext/string/inflections.rb:59:in `constantize' /Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/ i386/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/ pagination.rb:194:in `paginator_and_collection_for' /Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/ i386/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/ pagination.rb:129:in `paginate' #{RAILS_ROOT}/app/controllers/users_controller.rb:12:in `list' #{RAILS_ROOT}/app/controllers/users_controller.rb:3:in `index' /Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/ i386/bin/mongrel_rails:18 This error occured while loading the following files: user.rb
Help really appeciated!