vendredi 4 mars 2016

Can't route after user login in rails

I've been toying around with this rails application for the past couple of days to simply learn rails. That said i've hit a little snag. After implementing my latest addition to my rails app (authentication using bcrypt) I realized my rails app can no longer route to any of the links in the static_pages controller. Is there a way around this? Is is it my route implementation? Thank you for your help!

Before: localhost:3000/home After Login: localhost:3000/users/2 Error that I get when I click on home or any other link after login: GET localhost:3000/users/home 404 (Not Found)

Rails.application.routes.draw do
      resources :user
      root  'static_pages#home'
      match '/alex' , to: 'static_pages#alex', via: 'get'
      match '/help',    to: 'static_pages#help',    via: 'get'
      match '/about',   to: 'static_pages#about',   via: 'get'
      match '/home', to:'static_pages#home', via: 'get'
      match '/contact', to:'static_pages#contact', via:'get'
      match 'users/show' , to: 'users#show', via: 'get'
      get    'login'   => 'sessions#new'
      post   'login'   => 'sessions#create'
      delete 'logout'  => 'sessions#destroy'
      get '/signup' => 'users#new'
      resources :sessions, only: [:new, :create, :destroy]
end

Aucun commentaire:

Enregistrer un commentaire