Note that there are some explanatory texts on larger screens.

plurals
  1. PORails routes error
    primarykey
    data
    text
    <p>I am following along with Michael Hartl's <a href="http://ruby.railstutorial.org/ruby-on-rails-tutorial-book" rel="nofollow">Ruby on Rails Tutorial 2nd Edition</a> and have reached the signin/signout section of the book.</p> <p>So far I can create a new user (or in my case landlord) and log in with the new credentials. The problem I have is when signing out. I click "signout" and get a route error saying:</p> <blockquote> <p>No route matches [GET] "/signout"</p> </blockquote> <p>Below are code snippets. Any help would be very appreciated!</p> <p>rake routes output</p> <pre><code>landlords GET /landlords(.:format) landlords#index POST /landlords(.:format) landlords#create new_landlord GET /landlords/new(.:format) landlords#new edit_landlord GET /landlords/:id/edit(.:format) landlords#edit landlord GET /landlords/:id(.:format) landlords#show PUT /landlords/:id(.:format) landlords#update DELETE /landlords/:id(.:format) landlords#destroy properties GET /properties(.:format) properties#index POST /properties(.:format) properties#create new_property GET /properties/new(.:format) properties#new edit_property GET /properties/:id/edit(.:format) properties#edit property GET /properties/:id(.:format) properties#show PUT /properties/:id(.:format) properties#update DELETE /properties/:id(.:format) properties#destroy sessions POST /sessions(.:format) sessions#create new_session GET /sessions/new(.:format) sessions#new session DELETE /sessions/:id(.:format) sessions#destroy root / content_pages#home content_pages_home GET /content_pages/home(.:format) content_pages#home help /help(.:format) content_pages#help questions /questions(.:format) content_pages#questions signup /signup(.:format) landlords#new signin /signin(.:format) sessions#new signout DELETE /signout(.:format) sessions#destroy </code></pre> <p>routes.rb file</p> <pre><code> resources :landlords resources :properties resources :sessions, only: [:new, :create, :destroy] root :to =&gt; 'content_pages#home' get "content_pages/home" match '/help', to: 'content_pages#help' match '/questions', to: 'content_pages#questions' match '/signup', to: 'landlords#new' match '/signin', to: 'sessions#new' match '/signout', to: 'sessions#destroy', via: :delete </code></pre> <p>link to signout</p> <pre><code>&lt;%= link_to "Signout", signout_path, method: "delete" %&gt; </code></pre> <p>sessions controller</p> <pre><code>def destroy sign_out redirect_to root_path end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload