lib/assets/javascript/init.js.coffee in initjs-2.0.0.beta1 vs lib/assets/javascript/init.js.coffee in initjs-2.0.0
- old
+ new
@@ -3,11 +3,12 @@
unless $infos?
$infos = @$infos()
@appName($infos) unless @App
@execFilter('init')
- @exec($infos.data('resource').split('/'), $infos.data('action'))
+ resource = $infos.data('resource').split('/') if $infos.data('resource')
+ @exec(resource, $infos.data('action'))
initializePartial: ->
$infos = @$partialInfos()
if $infos.length > 0
@partial = true
@@ -22,9 +23,10 @@
@App = window[app_name]
console.log "Initjs: #{app_name} is not defined. Run `rails generate initjs:install` to generate the app file." unless @App?
exec: (resources, action) ->
@initModules(@App) unless @partial is true
+ return unless resources
controller_name = resources.pop()
namespace = @namespace(resources)
if namespace and controller_name
controller = namespace[controller_name]