i am new to rails, i followed the book "head first with rails"
this are the steps i did:
[email protected] ~/Desktop/tickets $ rails generate scaffold ticket name:string seat_id_seg:string address:text price_paid:decimal email_address:string
[email protected] ~/Desktop/tickets $ rake routes
tickets GET /tickets(.:format) tickets#index
POST /tickets(.:format) tickets#create
new_ticket GET /tickets/new(.:format) tickets#new
edit_ticket GET /tickets/:id/edit(.:format) tickets#edit
ticket GET /tickets/:id(.:format) tickets#show
PUT /tickets/:id(.:format) tickets#update
DELETE /tickets/:id(.:format) tickets#destroy
[email protected] ~/Desktop/tickets $ rake db:migrate
== CreateTickets: migrating ==================================================
== CreateTickets: migrated (0.1069s) =========================================
when i try going to localhost:3000/tickets
it comes out Routing Error and says "No route matches [GET] "/tickets"
> Started GET "/tickets" for 192.168.1.8 at Thu Jul 12 08:45:38 +0800 2012
Connecting to database specified by database.yml
ActionController::RoutingError (No route matches [GET] "/tickets"):
actionpack (3.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.6) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.6) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.6) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.6) lib/rails/engine.rb:479:in `call'
railties (3.2.6) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.6) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
rack (1.4.1) lib/rack/handler/webrick.rb:13:in `run'
rack (1.4.1) lib/rack/server.rb:265:in `start'
railties (3.2.6) lib/rails/commands/server.rb:70:in `start'
railties (3.2.6) lib/rails/commands.rb:55
railties (3.2.6) lib/rails/commands.rb:50:in `tap'
railties (3.2.6) lib/rails/commands.rb:50
Rendered /var/lib/gems/1.8/gems/actionpack-3.2.6/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (2.8ms)
how do i solve this? i want to be able to see the main page and with all the links to go to index, create new ticket, edit, show, update and delete.
I just did exactly as you wrote for a new Rails 3.2.6 app, and it worked fine for me. The only step you missed was to run
rake db:migrate after your scaffold generation. Try that and see if it works.