Sha256: ce7bf002220ff0e323533b5ea509ccf212825b16a28162429cbf9891de14a995
Contents?: true
Size: 895 Bytes
Versions: 3
Compression:
Stored size: 895 Bytes
Contents
class Comfy::Cms::BaseController < ApplicationController before_action :load_cms_site protected def load_cms_site @cms_site ||= if params[:site_id] ::Comfy::Cms::Site.find_by_id(params[:site_id]) else ::Comfy::Cms::Site.find_site(request.host_with_port.downcase, request.fullpath) end if @cms_site if @cms_site.path.present? && !params[:site_id] if params[:cms_path] && params[:cms_path].match(/\A#{@cms_site.path}/) params[:cms_path].gsub!(/\A#{@cms_site.path}/, '') params[:cms_path] && params[:cms_path].gsub!(/\A\//, '') else raise ActionController::RoutingError.new('Site Not Found') end end I18n.locale = @locale = @cms_site.locale.to_sym else I18n.locale = @locale = I18n.default_locale raise ActionController::RoutingError.new('Site Not Found') end end end
Version data entries
3 entries across 3 versions & 1 rubygems