Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 579807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:24:19+00:00 2026-05-13T14:24:19+00:00

I’ve installed RESTFUL authentication and everything seems to be working fine. i can signup

  • 0

I’ve installed RESTFUL authentication and everything seems to be working fine. i can signup and login. the only way i can logout is by typing in the URL http://localhost:3000/logout

how do i add a logout button on a page? i tried adding one to the members.rhtml

<%= link_to "logout", :controller=> "sessions", :action=> "destroy" %>

which references the session_controller.rb
but i get an error “No action responded to show. Actions: create, destroy, and new”

any thoughts? thanx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:24:19+00:00Added an answer on May 13, 2026 at 2:24 pm

    What do you have in your routes file?

    Try putting

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

    in your routes.

    Then just have

    <%= link_to "Sign out", log_out_url %>
    

    for the sign out link.

    EDIT

    Its all down to how you specify the routing.

    Because you had the map.log_out in the routing, then the url http://localhost:3000/logout url is picked up by this and routed to the correct action.

    If you have :

    <%= link_to "logout", :controller=> "sessions", :action=> "destroy" %>
    

    This will just generate a link for you of http://localhost:3000/session. But, it does nothing to the routing. You still need to specify the correct routes.

    Note that Rails does not append the destroy action to the url. (It will not create http://localhost:3000/session/destroy.) It assumes that if you have an action of destroy that you will be sending it with a DELETE http verb. For some reason, its not quite perfect and it doesnt actually also default to sending the DELETE verb.

    You can force it to do this :

    <%= link_to "logout", {:controller=> "user_sessions", :action=> "destroy"}, :method => :delete%>
    

    This will still not work unless you also route it correctly. If you put the following into the routes :

    map.resource :session
    

    Then rails will generate the routing for all the verbs and specify the default actions for them, including DELETE. More information can be found here : Rails Routing from the Outside In.

    That whole page is worth reading over and over until you really understand it. Routing is key to understanding Rails!

    For a simple controller like Sessions, it is easier just to specify the log_out route and then link to log_out_url..

    (Hope that makes sense, sleep deprivation is creeping in!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.