2

私はレールを初めて使用します。「head first with rails」という本に従いました

これは私が行った手順です:

$rails tickets

shaun@master ~/Desktop/tickets $ rails generate scaffold ticket name:string seat_id_seg:string address:text price_paid:decimal email_address:string


shaun@master ~/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


    shaun@master ~/Desktop/tickets $ rake db:migrate
==  CreateTickets: migrating ==================================================
-- create_table(:tickets)
   -> 0.1065s
==  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'
  /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
  /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
  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
  script/rails:6:in `require'
  script/rails:6


  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)

どうすればこれを解決できますか? メインページと、インデックスへの移動、新しいチケットの作成、編集、表示、更新、および削除へのすべてのリンクを表示できるようにしたいと考えています。

4

1 に答える 1

2

あなたが新しいRails 3.2.6アプリについて書いたのとまったく同じようにやったところ、うまくいきました。あなたが見逃した唯一のステップはrake db:migrate、足場の世代の後に実行することでした. それを試して、それが機能するかどうかを確認してください。

于 2012-07-12T00:25:16.083 に答える