Created
February 11, 2016 19:55
-
-
Save Frank004/d5020576db5e3ebe9d56 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
before_filter :authenticate_user! | |
protect_from_forgery with: :exception | |
before_filter :configure_permitted_parameters, if: :devise_controller? | |
def after_sign_out_path_for(resource_or_scope) | |
new_user_session_path | |
end | |
#esto lo tengo porque tengo 2 tipos de user que quiero redirigir cuando inicien la sección. | |
#si no usas esto entonces rails usara el que hice en el route. | |
def after_sign_in_path_for(user) | |
if user.role == "super_admin" | |
panel_path | |
else user.role == "admin" | |
company_path(current_user.company) | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HBM::Application.routes.draw do | |
devise_scope :user do | |
root to: 'devise/sessions#new' , :as => "login" | |
end | |
authenticated do | |
root 'dashboard#index', :as => "panel" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment