On 11 September 2010 04:46, James Byrne <[email protected]> wrote:
> Msan Msan wrote:
>> On 10 September 2010 15:40, Sandy <[email protected]> wrote:
>>>
>>> �My routes.rb has �resources :rusers.
>>> �Try putting the following line into routes.rb:
>>> �map.connect 'user/logout', :controller => 'user', :action => 'logout'
>>
>> But....I have to set a route for every custom action that I add to
>> controller?
>
> Yes. . . and No.
>
> If you insist on using a custom method in your controller then yes, you
> will have to specify a route for it. However, you really should be
> looking at things from the point of view of utilizing only the basic
> crud actions of create, show, update and delete.
>
> Consider what the verb logout implies. Logout from what? A session?
> Then what are we actually doing with respect to a session? Deleting it?
> Then perhaps the problem is that you really need another controller, say
> user_sessions_controller, and that the delete action in that controller
> is what should perform the logout action.
So I've to do something like this?
class SessionsController < ApplicationController
def destroy
session[:cas_user] = nil
session.delete(:casfilteruser)
CASClient::Frameworks::Rails::Filter.logout(self, rusers_url)
end
end
and in html.erb page:
<%= link_to 'Logout', :controller => 'sessions', :action => 'destroy' %>
I think it is still not REST.
I'm confused.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.