msan
September 13, 2010, 1:54pm
1
In routes.rb I’ve put:
resources :sessions
controller is:
class SessionsController < ApplicationController
def destroy
session[:id] = nil
session.delete(:casfilteruser)
CASClient::Frameworks::Rails::Filter.logout(self)
end
end
In application.html.erb I have:
<%= link_to ‘Logout’, session_path(session[:cas_user]), :method =>
:delete %>
I think it’s all but:
No route matches {:action=>“destroy”, :controller=>“sessions”,
:id=>“name.surname”}
What I’ve missed?
msan
September 13, 2010, 3:55pm
2
you dont need to pass this session[:cas_user]
msan
September 13, 2010, 4:03pm
3
the default destroy route is
/controller/id , :method=> delete
{:action=>“destroy”, :controller=>“sessions”, :id=>“name.surname”}
but your destroy action does not need an id really,
the other problem is that you dont need an id but pass
session_path(session[:cas_user])
and then not use it becuase you do this
session[:id] = nil
im not user if yo want to do this
session[:cas_user] = nil
msan
September 13, 2010, 5:57pm
4
On 13 September 2010 16:02, radhames brito [email protected] wrote:
the default destroy route is
/controller/id , :method=> delete
{:action=>“destroy”, :controller=>“sessions”, :id=>“name.surname”}
but your destroy action does not need an id really,
So I’ve to change the default destroy route for sessions resource?
msan
September 13, 2010, 5:58pm
5
Msan M. wrote:
On 13 September 2010 16:02, radhames brito [email protected] wrote:
the default destroy route is
/controller/id�������� , :method=> delete
{:action=>“destroy”, :controller=>“sessions”, :id=>“name.surname”}
but your destroy action does not need an id really,
So I’ve to change the default destroy route for sessions resource?
Perhaps you should be using a singleton resource for sessions the way
Authlogic does?
Best,
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
msan
September 13, 2010, 9:17pm
6
i think you should,
resources user, :except => :destroy
then
match you path here
msan
September 13, 2010, 9:43pm
7
@Daniel Gaytán
but the default destroy route will still wait for an id, and he doesnt
needs
if since the user is in the session
On Mon, Sep 13, 2010 at 3:38 PM, Daniel Gaytán
<[email protected]
msan
September 13, 2010, 9:39pm
8
I think you are missing the rails javascript file, which is who actually
handles the special links.
When you click on the link, the method is GET, so you don’t hace any
toute
related to the action destroy in that method.
Daniel Gaytán
2010/9/13 radhames brito [email protected]
msan
September 13, 2010, 10:01pm
9
yes i agree
On Mon, Sep 13, 2010 at 3:57 PM, Daniel Gaytán
<[email protected]
msan
September 13, 2010, 9:58pm
10
Then it may be set as resource instead of resources
or maybe
resources :something, :except => :destroy do
delete :destroy, :on => :collection, :as => :destroy
end
Daniel Gaytán
2010/9/13 radhames brito [email protected]
msan
September 13, 2010, 10:11pm
11
no, that his is a way to build the route
resources :something, :except => :destroy do
delete :destroy, :on => :collection, :as => :destroy
end
msan
September 13, 2010, 10:04pm
12
On Mon, Sep 13, 2010 at 3:00 PM, radhames brito [email protected]
wrote:
yes i agree
That you don’t know how to trim a post?
–
Greg D.
destiney.com | gregdonald.com
msan
September 14, 2010, 9:47am
13
On 14 September 2010 09:14, Mauro [email protected] wrote:
delete :destroy, :on => :collection, :as => :destroy
end
If I do
resources :sessions, :except => :destroy do
delete :destroy, :on => :collection, :as => :destroy
end
Then It call update instead of destroy:
<%= link_to ‘Logout’, session_path, :method => :delete %>
No route matches {:action=>“update”, :controller=>“sessions”}
I think I’ve solved using resource :session.
Thanks to all.
msan
September 14, 2010, 9:16am
14
On 13 September 2010 21:57, Daniel Gaytán
[email protected] wrote:
Then it may be set as resource instead of resources
or maybe
resources :something, :except => :destroy do
delete :destroy, :on => :collection, :as => :destroy
end
If I do
resources :sessions, :except => :destroy do
delete :destroy, :on => :collection, :as => :destroy
end
Then It call update instead of destroy:
<%= link_to ‘Logout’, session_path, :method => :delete %>
No route matches {:action=>“update”, :controller=>“sessions”}