Sha256: 112aae491163d1890e4632ff792bf4d0d6553b6ff6c53a600a6808df127b7b4d

Contents?: true

Size: 525 Bytes

Versions: 1

Compression:

Stored size: 525 Bytes

Contents

module RailsScript
  module LoaderHelper

    def include_rails_script
      javascript_tag <<-RUBY
window.Utility || (window.Utility = {});
Utility.RailsVars = #{@to_javascript.nil? ? '{}' : @to_javascript.to_json};

(function() {
  window.$this = new (App.#{ controller_path.split(/\/|_/).map(&:capitalize).join('') } || App.Base)();
  if (typeof $this.all === 'function') {
    $this.all.call();
  }
  if (typeof $this.#{ action_name } === 'function') {
    $this.#{ action_name }.call();
  }
})();
RUBY
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_script-0.5.0 lib/rails_script/loader_helper.rb