Dodjs
Dodjs

Reputation: 819

Routing error (missing template)

My rout.rb

map.logout 'logout', :controller => 'sessions', :action => 'destroy'  

map.login 'login', :controller => 'sessions', :action => 'new'  

In sessions control have destroy method, but when I type /logout it's say: Missing template session/destroy.erb in view path app/view

Upvotes: 1

Views: 5423

Answers (2)

Zabba
Zabba

Reputation: 65517

Add a file name destroy.html.erb to the folder app/views/sessions.

Note that sessions is plural (I think you mis-typed the session in the error message you posted?)

Upvotes: 0

mark
mark

Reputation: 10574

You have an action but you don't have a view. You can either make a view destroy.html.erb, render :action => 'index' (for example) or more likely redirect_to :action => 'index' after the destroy action has completed.

Upvotes: 2

Related Questions