Module: BarkestCore::MainAppUrlHelper

Defined in:
lib/barkest_core/extensions/main_app_extensions.rb

Overview

Gives the ability to hunt for a ‘main_app’ helper if a URL helper is missing.

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/barkest_core/extensions/main_app_extensions.rb', line 8

def self.included(base)
  base.class_eval do

    # :nodoc:
    alias :barkest_core_original_method_missing :method_missing

    # :nodoc:
    def method_missing(method, *args, &block)

      if respond_to?(:main_app)
        main_app = send(:main_app)
        if main_app && main_app.respond_to?(method)
          return main_app.send(method, *args, &block)
        end
      end

      barkest_core_original_method_missing(method, *args, &block)
    end

  end
end