Dlaczego otrzymuję błąd routingu podczas odwiedzania strony użytkowników w mojej aplikacji Ruby on Rails?

Próbuję dodać komentarze do mikropostów znalezionych whttps://github.com/railstutorial/sample_app_2nd_ed z podręcznika Michaela Hartla.

Wydaje się, że jeśli użytkownik nie wykonał żadnych mikropostów, nie ma problemu i mogę uzyskać dostęp do ich strony. Jeśli jednak mają, występuje błąd routingu. To jest mój problem.

Oto obszar, o którym mowa w moim pliku routes.rb.

resources :microposts, only: [:create, :destroy] do
    resources :comments, 
  end

To jest błąd, który pojawia się, gdy próbuję odwiedzić stronę użytkownika (localhost: 3000 / users / 2):

Started GET "/users/2" for 127.0.0.1 at 2012-05-21 21:32:47 -0700
Processing by UsersController#show as HTML
  Parameters: {"id"=>"2"}
  User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", "2"]]
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'iGivWVhrOQL2tp1MOOJwgA' LIMIT 1
  Rendered users/_follow_form.html.erb (0.8ms)
   (0.2ms)  SELECT COUNT(*) FROM "microposts" WHERE "microposts"."user_id" = 2
  CACHE (0.0ms)  SELECT COUNT(*) FROM "microposts" WHERE "microposts"."user_id" = 2
  Micropost Load (0.1ms)  SELECT "microposts".* FROM "microposts" WHERE "microposts"."user_id" = 2 ORDER BY microposts.created_at DESC LIMIT 30 OFFSET 0
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
  Rendered microposts/_micropost.html.erb (12.2ms)
  Rendered users/show.html.erb within layouts/application (53.1ms)
Completed 500 Internal Server Error in 69ms

ActionController::RoutingError (No route matches {:controller=>"comments", :format=>nil, :micropost_id=>#<Micropost id: nil, content: nil, user_id: nil, created_at: nil, updated_at: nil>}):
  app/views/microposts/_micropost.html.erb:23:in `_app_views_microposts__micropost_html_erb___1795431923022101738_32372620'
  app/views/users/show.html.erb:16:in `_app_views_users_show_html_erb__1221738286899740817_32260600'


  Rendered /home/alex/.rvm/gems/ruby-1.9.3-p125@rails3tutorial2ndEd/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.6ms)

tutaj jest wyjście komentarzy grep | rake

user_comments GET    /users/:user_id/comments(.:format)                    comments#index
                       POST   /users/:user_id/comments(.:format)                    comments#create
      new_user_comment GET    /users/:user_id/comments/new(.:format)                comments#new
     edit_user_comment GET    /users/:user_id/comments/:id/edit(.:format)           comments#edit
          user_comment GET    /users/:user_id/comments/:id(.:format)                comments#show
                       PUT    /users/:user_id/comments/:id(.:format)                comments#update
                       DELETE /users/:user_id/comments/:id(.:format)                comments#destroy
    micropost_comments GET    /microposts/:micropost_id/comments(.:format)          comments#index
                       POST   /microposts/:micropost_id/comments(.:format)          comments#create
 new_micropost_comment GET    /microposts/:micropost_id/comments/new(.:format)      comments#new
edit_micropost_comment GET    /microposts/:micropost_id/comments/:id/edit(.:format) comments#edit
     micropost_comment GET    /microposts/:micropost_id/comments/:id(.:format)      comments#show
                       PUT    /microposts/:micropost_id/comments/:id(.:format)      comments#update
                       DELETE /microposts/:micropost_id/comments/:id(.:format)  

a oto mój comments_controller.rb

class CommentsController < ApplicationController 
  def create
    @micropost = Micropost.find(params[:micropost_id]) 
    @comment = @micropost.comments.build(params[:comment]) 
    @comment.user = current_user

    if @comment.save 
      redirect_to @micropost
    else 
      redirect_to @micropost
    end 
  end 

  def show
    @comment = Comment.find(params[:id])
  end

  def new 

  end

  def destroy
    @comment = Comment.find(params[:id])
    @comment.destroy
    redirect_back_or root_path
  end
end

questionAnswers(0)

yourAnswerToTheQuestion