Filter chain halted error with devise gem
10,049
You can override session controller like this:
route.rb
devise_scope :user do
root to: "users/sessions#new"
end
app/controller/users/sessions_controller.rb
class Users::SessionsController < Devise::SessionsController
prepend_before_filter :require_no_authentication, :only => [ :new, :create, :cancel ]
end
Author by
Sam
Updated on June 04, 2022Comments
-
Sam almost 2 years
I am using devise with rails. I have generated User model in devise and I didn't have user controller and home controller . My root page is
devise/sessions#new
.My root path
devise_scope :user do root :to => "users/sessions#new" end devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks", :registrations => "users/registrations" }
when I run localhost:3000 I am getting the following error.
Filter chain halted as :require_no_authentication rendered or redirected. Started GET "/" for 127.0.0.1 at 2014-02-19 10:07:46 +0530 Processing by Devise::SessionsController#new as HTML User Load (0.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1 Redirected to http://localhost:3000/ Filter chain halted as :require_no_authentication rendered or redirected Completed 302 Found in 3ms (ActiveRecord: 0.2ms)
The solution I found on internet is that add this in sessions controller
prepend_before_filter :require_no_authentication, :only => [ :new, :create, :cancel ]
. My doubt is how can I access sessions controller. It is not generated in controller it is inbuilt module or is there any other way to solve this.app/controller/users/session_controller.rb
class Users::SessionsController < Devise::SessionsController prepend_before_filter :require_no_authentication, :only => [ :new, :create, :cancel ] end
-
Sam about 10 years@vanda- I am once again getting the same error. I have updated what I ve done
-
vahid abdi about 10 years
-
Sam about 10 yearsI found the real error. In root path I should not give sign in path. I need to mention some other path