“No matches in route” Error while deleting microflow in chapter 11 of Hartl ruby ​​rail tutorial - completely blocked

I am trying to find a particularly elusive mistake when working with Michael Hartle’s ROR tutorial.

When you click "Delete" for micropost (from the home page or user / display page) the URL is http: // localhost: 3000 / microposts / 303 , but the result is "Routing error - there are no route matches" / microposts / 303 ".

I looked at every page of my code that was involved and replaced them with code from the Hartl gitHub project site. https://github.com/railstutorial/sample_app . For example, for microposts_controller, I copied the code from the GitHub depot and replaced my code with the copied code. Then I restarted the server. The same result. Then I went back to my code to test the next page.

Pages to which I changed the code -

CONTROLLERS microposts_controller users_controller (show method)

MODEL micropost.rb (model)

OPINIONS microposts / _micropost.haml general /_micropost_form.html.haml general / _feed.haml general /_feed_item.haml

and route file.

I find it difficult to check other things. Anyone have any suggestions?

Thank,

Dave

Rake Route Results

 sessions POST   /sessions(.:format)       {:action=>"create", :controller=>"sessions"}
new_session GET    /sessions/new(.:format)   {:action=>"new", :controller=>"sessions"}
    session DELETE /sessions/:id(.:format)   {:action=>"destroy", :controller=>"sessions"}
     signin        /signin(.:format)         {:controller=>"sessions", :action=>"new"}
    signout        /signout(.:format)        {:controller=>"sessions", :action=>"destroy"}
 microposts POST   /microposts(.:format)     {:action=>"create", :controller=>"microposts"}
  micropost DELETE /microposts/:id(.:format) {:action=>"destroy", :controller=>"microposts"}
       root        /(.:format)               {:controller=>"pages", :action=>"home"}
    contact        /contact(.:format)        {:controller=>"pages", :action=>"contact"}
      about        /about(.:format)          {:controller=>"pages", :action=>"about"}
       help        /help(.:format)           {:controller=>"pages", :action=>"help"}
     signup        /signup(.:format)         {:controller=>"users", :action=>"new"}
development        /development(.:format)    {:controller=>"pages", :action=>"development"}
                   /signup(.:format)         {:controller=>"users", :action=>"new"}
      users GET    /users(.:format)          {:action=>"index", :controller=>"users"}
            POST   /users(.:format)          {:action=>"create", :controller=>"users"}
   new_user GET    /users/new(.:format)      {:action=>"new", :controller=>"users"}
  edit_user GET    /users/:id/edit(.:format) {:action=>"edit", :controller=>"users"}
       user GET    /users/:id(.:format)      {:action=>"show", :controller=>"users"}
            PUT    /users/:id(.:format)      {:action=>"update", :controller=>"users"}
            DELETE /users/:id(.:format)      {:action=>"destroy", :controller=>"users"}

File Routes.rb

SampleApp::Application.routes.draw do

#Sign in Routes
  resources :sessions, :only => [:new, :create, :destroy]
  match '/signin', :to => 'sessions#new'
  match '/signout', :to => 'sessions#destroy'

#Microposts Routes
  resources :microposts, :only => [:create, :destroy]


#Pages Routes
  root :to => "pages#home"

  match '/contact', :to => 'pages#contact'
  match '/about',   :to => 'pages#about'
  match '/help',    :to => 'pages#help'
  match '/signup',  :to => 'users#new'
  match '/development', :to => 'pages#development'

#Users Routes
  match '/signup',  :to => 'users#new'
  resources :users

end

, , gitHub .

-

 = link_to "delete", micropost, :method => :delete,
                                      :confirm => "You sure?",
                                      :title => micropost.content
+3
1

link_to :method => :delete javascript DELETE. , javascript (prototype.js/jquery.js rails.js), .

+3

All Articles