Sha256: 22ea8cf235981b08dc4b73a482ccc80377d552e7f0922abb728fe55c18acd0d8
Contents?: true
Size: 834 Bytes
Versions: 4
Compression:
Stored size: 834 Bytes
Contents
class Storytime::ApplicationController < ApplicationController layout Storytime.layout || "storytime/application" include Pundit rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized helper :all def setup url = if Storytime.user_class.count == 0 main_app.new_user_registration_url elsif current_user.nil? main_app.new_user_session_url elsif Storytime::Site.count == 0 new_dashboard_site_url else url_for([:dashboard, Storytime::BlogPost]) end redirect_to url end private def ensure_site redirect_to new_dashboard_site_url unless devise_controller? || @site = Storytime::Site.first end def user_not_authorized flash[:error] = "You are not authorized to perform this action." redirect_to(request.referrer || storytime_root_path) end end
Version data entries
4 entries across 4 versions & 1 rubygems