mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 09:27:19 +02:00
21 lines
615 B
Ruby
21 lines
615 B
Ruby
class ApplicationController < ActionController::Base
|
|
# Prevent CSRF attacks by raising an exception.
|
|
# For APIs, you may want to use :null_session instead.
|
|
protect_from_forgery with: :exception
|
|
|
|
before_action do
|
|
resource = controller_name.singularize.to_sym
|
|
method = "#{resource}_params"
|
|
params[resource] &&= send(method) if respond_to?(method, true)
|
|
end
|
|
|
|
def after_sign_in_path_for(resource)
|
|
return session[:user_return_to].to_s if session[:user_return_to]
|
|
|
|
if resource.admin? && can?(:create, :admin_session)
|
|
admin_root_path
|
|
else
|
|
client_root_path
|
|
end
|
|
end
|
|
end
|