Module: Proscenium::EnsureLoaded

Defined in:
lib/proscenium/ensure_loaded.rb

Class Method Summary collapse

Class Method Details

.included(child) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/proscenium/ensure_loaded.rb', line 7

def self.included(child)
  child.class_eval do
    append_after_action do
      if request.format.html? && Importer.imported?
        if Importer.js_imported?
          raise NotIncludedError, 'There are side loaded javascripts to be included, but ' \
                                  'they have not been included in the page. Did you forget ' \
                                  'to add the `#include_assets` helper in your views?'
        end

        if Importer.css_imported?
          raise NotIncludedError, 'There are side loaded stylesheets to be included, but ' \
                                  'they have not been included in the page. Did you forget ' \
                                  'to add the `#include_assets` helper in your views?'
        end
      end
    end
  end
end