ruby - Rails devise help routing error No route matches "/sessions/user" -
when login on page automatic go route: http://localhost:3000/sessions/user
and error:
routing error no route matches "/sessions/user"
i have created controller named sessions_controller.rb in users folder here is:
class users::sessionscontroller < devise::sessionscontroller def new redirect_to root_url, :notice => "you have been logged out." end def create user = user.authenticate(params[:login], params[:encrypted_password]) if user session[:user_id] = user.id redirect_to root_url, :notice => "logged in successfully." else flash.now[:alert] = "invalid login or password." render :action => 'new' end end def destroy session[:user_id] = nil redirect_to root_url, :notice => "you have been logged out." end end
my route file:
densidste::application.routes.draw match 'user/edit' => 'users#edit', :as => :edit_current_user devise_for :users, :controllers => { :sessions => "users/sessions" } "login", :to => "devise/sessions#new" "opret", :to => 'users/users#new' "logud", :to => 'users/users#destroy' end resources :sessions resources :users devise_for :users, :controllers => { :sessions => "users/sessions" } resources :aktivs resources :taggingposts resources :tags resources :kommentares resources :posts end
(old question ran same issue when setting devise, hope helps others)
removing resources :sessions
routes file should solve problem.
Comments
Post a Comment