Sha256: 854b7596b76fc9b0156d46467bd260f7c1fdc19ab71979ce0925ab268a780bdc
Contents?: true
Size: 950 Bytes
Versions: 3
Compression:
Stored size: 950 Bytes
Contents
class CmsAdmin::BaseController < ApplicationController protect_from_forgery # Authentication module must have #authenticate method include ComfortableMexicanSofa.config.authentication.to_s.constantize before_filter :authenticate, :load_admin_cms_site layout 'cms_admin' protected def load_admin_cms_site hostname = request.host.downcase @cms_site = Cms::Site.find_by_hostname!(hostname) rescue ActiveRecord::RecordNotFound unless ComfortableMexicanSofa.config.enable_multiple_sites if Cms::Site.count == 0 @cms_site = Cms::Site.create!(:label => 'Default Site', :hostname => hostname) else @cms_site = Cms::Site.first @cms_site.update_attribute(:hostname, hostname) end end unless @cms_site flash[:error] = 'No Site defined for this hostname. Create it now.' return redirect_to(cms_admin_sites_path) end end end
Version data entries
3 entries across 3 versions & 1 rubygems