Sha256: 00bb533fa1a8e04b281352b756e1a567659706feb878dc1c90f6db41ed216811
Contents?: true
Size: 792 Bytes
Versions: 13
Compression:
Stored size: 792 Bytes
Contents
module Locomotive module Concerns module SiteDispatcherController extend ActiveSupport::Concern included do if self.respond_to?(:before_action) helper_method :current_site end end protected def current_site @current_site ||= request.env['locomotive.site'] end def current_site? !current_site.nil? end def require_site return true if current_site? render_no_site_error end def render_no_site_error respond_to do |format| format.html do redirect_to sites_path end format.json do render json: { error: 'No site found' }, status: :not_found end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems