Skip to content

Instantly share code, notes, and snippets.

@Frank004
Created February 11, 2016 19:55
Show Gist options
  • Save Frank004/d5020576db5e3ebe9d56 to your computer and use it in GitHub Desktop.
Save Frank004/d5020576db5e3ebe9d56 to your computer and use it in GitHub Desktop.
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
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