Sha256: 133095f0a0fd1409b0f2dcfdbe18699328b6d3ba8500ac53a8dc109e82b173e9
Contents?: true
Size: 811 Bytes
Versions: 1
Compression:
Stored size: 811 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 dashboard_posts_url 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
storytime-0.0.2 | app/controllers/storytime/application_controller.rb |