Sha256: 360ed79b575aeb0800f72489d2ed493b9398a9b5ccccb18c8653fdf88e2ff6dc
Contents?: true
Size: 764 Bytes
Versions: 1
Compression:
Stored size: 764 Bytes
Contents
# frozen_string_literal: true require 'motorhead/errors' module Motorhead module Engine extend ActiveSupport::Concern module ClassMethods attr_accessor :on_error def active_if(&block) @active_if = block end def active?(controller) controller.instance_eval(&@active_if) end def mount_at(path = nil) if path @mount_at = path else defined?(@mount_at) && @mount_at end end end included do isolate_namespace self.parent engine_kls = self ActiveSupport.on_load :after_initialize do Rails.application.routes.prepend do mount engine_kls, at: engine_kls.mount_at || '/' end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
motorhead-0.5.0 | lib/motorhead/engine.rb |