Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGuillaume Simon
1,841 PointsSign_out won't work
I'm currently doing this project " Generating the Devise Views". I try to signout using http://0.0.0.0:3000/users/sign_out but i always get a routing error. I tried to restart my server but i keep being logged in. What can i do to destroy my current session ? http://teamtreehouse.com/library/build-a-simple-ruby-on-rails-application/creating-an-authentication-system/generating-the-devise-views
4 Answers
Sergio Barrera
4,198 PointsHello, I also have trouble signing out. I tried the route destroy_user_session by browsing to "0.0.0.0:3000/users/sign_out" the command line and I get the message: No route matches [GET] "/users/sign_out" It won't let me sign out. Are we supposed to use any route created by devise without declaring it on the routes.rb? Thanks!
Guillaume Simon
1,841 PointsSergio, you can use the rails console to delete your user in the database (it can help to continue working) but i still don't figure out how to sign_out... I hope someone will help us.
Sergio Barrera
4,198 PointsThanks Guillaume, I'm also trying to find out why the 3 new fields: first_name, last_name and profile_user are not showing up even they are declared in the new.html.erb file. Did you get to see those fields?
Sergio Barrera
4,198 PointsYeap, I can continue working on it( if I destroy the user) but still won't sign_out: it says Routing error No route matches [GET] "/users/sign_out"
The it prints out all the routes we have available.
Thanks for your help!
Luke Bearden
15,597 PointsI am unable to continue the task to the sign up page with the added fields because I cannot sign out. Any help treehouse?
Nikolay Batrakov
9,604 PointsNikolay Batrakov
9,604 PointsWhen you're trying to send a request to sign out your browser is generating a GET request to rails. Rails though is waiting so called DELETE method. From the rake routes:
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
That is not common http request, rails POSTed it, but emulate this DELETE method by sending special parameter.I wasn't able to find a way how to do that in browser so I just put
<li><%= link_to "Sign out", destroy_user_session_path, :method => :delete %></li>
into "nav" class <ul> and was able to sign out in any given moment. Hope it'll be helpful