Sha256: b8f05a869d42065845659f7b848db23ca7ca25f7cfebbfba26e70229effdea3f
Contents?: true
Size: 853 Bytes
Versions: 1
Compression:
Stored size: 853 Bytes
Contents
module Storytime class ApplicationController < ActionController::Base # layout Storytime.layout rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized def after_sign_up_path_for(user) if Storytime::User.count == 1 new_dashboard_site_url else dashboard_posts_url end end def setup url = if User.count == 0 new_user_registration_url elsif Site.count == 0 new_dashboard_site_url else dashboard_posts_url end redirect_to url end private def ensure_site redirect_to new_dashboard_site_url unless devise_controller? || @site = Site.first end def user_not_authorized flash[:error] = "You are not authorized to perform this action." redirect_to(request.referrer || root_path) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
storytime-0.0.1 | app/controllers/storytime/application_controller.rb |