Sha256: 475dc3efeede6a3ce87eac1f038c5ac44c056f29c4fdb8b45315503b490f8419
Contents?: true
Size: 1015 Bytes
Versions: 16
Compression:
Stored size: 1015 Bytes
Contents
class Proclaim::ApplicationController < ApplicationController include Pundit rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized private def user_not_authorized flash[:error] = "You are not authorized to perform this action." redirect_to(request.referrer || root_path) end def authenticate_author begin send(Proclaim.authentication_method) rescue NoMethodError raise "Proclaim doesn't know how to authenticate users! Please" \ " ensure that `Proclaim.authentication_path` is valid." end end def current_author begin send(Proclaim.current_author_method) rescue NoMethodError raise "Proclaim doesn't know how to get the current author! Please" \ " ensure that `Proclaim.current_author_method` is valid." end end def pundit_user current_author end def image_id_and_name_from_url(url) match = url.match(/([^\/]*?)\/([^\/]*)\z/) return match[1], match[2] end def cache_name_from_url(url) url.match(/[^\/]*?\/[^\/]*\z/) end end
Version data entries
16 entries across 16 versions & 1 rubygems