My site should work just like facebook.com. If the user is registered, and if he goes to "/", he must be processed by the home controller. If it is not logged, it must be processed by the landing_page .
"/ " && & user_signed_in? ---> home controller
"/" && & user_not_logged ---> dispatcher
I am using Rails 4 and Devise
ApplicationController
class ApplicationController < ActionController::Base before_filter :authenticate_user! end
Routes.rb
get "landing_page/index" root 'home#index', :as => :home
How could I save the "before_filter" in the ApplicationControl that runs in each controller, except for the controller "landing_page"?
Update
If I go to the "/ en / landing_page_page" page, it will correctly display the landing_page descriptor (logged out), but if I go to "/", it will redirect me to "/ users / sign_in"
class LandingPageController < ApplicationController skip_before_action :authenticate_user! def index end end class ApplicationController < ActionController::Base before_action :authenticate_user! end
routes.rb
root 'landing_page#index'
source share