ruby on rails - Logout button not working on mobile devices -


thanks taking time @ question. ok, have weird bug that's been tricky figure out. logout button on app works fine unless you're using mobile device. here's error i'm getting (again keep in mind it's on mobile device):

no route matches [delete] "/salir" 

here's code:

application_controller.rb

def current_user   @current_user ||= user.find(session[:user_id]) if session[:user_id] end  def require_current_user   current_user   redirect_to root_path unless @current_user end 

_header.html.erb

<li><%= link_to '<i class="fa-power-off"></i> salir'.html_safe, salir_es_path, method: :delete, class: "text-danger" %></li> 

session_controller.rb

def destroy   reset_session   redirect_to root_url end 

routes.rb

root 'providers#index'    localized     resources :sessions, only: [:new, :create, :destroy],     path_names: { new: "ingresa", destroy: 'salir' }     '/login', to: 'sessions#login', as: 'login'   '/salir', to: 'sessions#destroy', as: 'salir' end 

a cursory @ routes file seem indicate get '/salir' line problem.

note error indicates there no route matching delete (versus entry in routes get).

my sense following change help:

# '/salir', to: 'sessions#destroy', as: 'salir' #  match '/salir', to: 'sessions#destroy', as: 'salir', via: :delete 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -