Sha256: 6b8b5f685537f6d00379921b021457253c893cbafe8806e52e13b26918bb3fb8
Contents?: true
Size: 792 Bytes
Versions: 19
Compression:
Stored size: 792 Bytes
Contents
module Locomotive module Concerns module SiteDispatcherController extend ActiveSupport::Concern included do if self.respond_to?(:before_filter) 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
19 entries across 19 versions & 1 rubygems