Take the 2-minute tour ×

I'm working on a simple Rails 3.2 app. I have been following Ruby on Rails Tutorial for managing users and sessions (cookies). The routing error occurs when I try to sign out. It works without any errors on my desktop machine, but it gives me a routing error when I try on my iOS devise (from Heroku).

After clicking on sign out on Heroku I get the following error:

The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved 

With the url: .../sessions#

I don't know where the # comes from in the url.

If I try it on my local machine, using the iOS simulator or connecting with my device to my ip address I get the following error:

Started DELETE "/sessions" for at 2012-04-23 18:10:41 +0200

ActionController::RoutingError (No route matches [DELETE] "/sessions"):

With the url: .../sessions#

Again, I don't know where the #in the URL comes from.

My routes looks like this:

resources :sessions, only: [:new, :create, :destroy]

match '/signup',  to: 'users#new'
match '/signin',  to: 'sessions#new'
match '/signout', to: 'sessions#destroy', via: :delete

My SessionsController looks like this:

def new

def create
  user = User.find_by_email(params[:email])
  if user && user.authenticate(params[:password])
    sign_in user
    redirect_to root_path
    render 'new'

def destroy 
  redirect_to root_path

My sign out method that is located in my SessionsHelper looks like this:

def sign_out
  current_user = nil

My sign out link looks like this:

<%= link_to "Sign out", signout_path, method: "delete", "data-icon" => "arrow-r", "data-iconpos" => "right",  "data-theme" => "b", :class => "ui-btn-right", "data-ajax" => "false" %>

Note, I use jQuery mobile for styling the mobile version.

Does anyone know what I'm doing wrong, or what could be causing the error?

For completion, when I run rake routes I get the following result:

root        /                         pages#home
sessions POST   /sessions(.:format)       sessions#create
new_session GET    /sessions/new(.:format)   sessions#new
session DELETE /sessions/:id(.:format)   sessions#destroy


share|improve this question
You can view the page source and see what is the output of the "link_to" method above. –  Salil Apr 24 '12 at 4:15

Your Answer



Browse other questions tagged or ask your own question.