Module: RequirejsControllersHelper

Defined in:
app/helpers/requirejs_controllers_helper.rb

Instance Method Summary collapse

Instance Method Details

#requirejs_controller_tagObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/requirejs_controllers_helper.rb', line 2

def requirejs_controller_tag
  html = requirejs_include_tag
  html.concat <<-HTML.html_safe
  <script>
  define('main', function() {
    require(['controllers/#{controller.controller_path}'], function(controller) {
      window.controller = new controller('#{controller.action_name}')
    })
  })
  </script>
  HTML
  html.html_safe
end