Sha256: 89a5c7a38a194580796a8ec0ee80b60d93e2d61492aebed8f01d7c43460c4030

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

require 'jquery_on_rails'
require 'rails'

class JQueryOnRails::Railtie < Rails::Railtie
  
  initializer "jquery_on_rails.action_view_helpers" do
    ActiveSupport.on_load(:action_view) do
      # We want to override Prototype and Scriptaculous - include them first.
			require 'action_view/helpers'
			require 'action_view/helpers/javascript_helper'
			require 'action_view/helpers/prototype_helper'
			require 'action_view/helpers/scriptaculous_helper'
		
      # Include our helpers that override everything.
			require 'jquery_on_rails/helpers/jquery_helper'
			ActionView::Helpers::JavaScriptHelper.send :include, JQueryOnRails::Helpers::JQueryHelper
			ActionView::Helpers.send :include, JQueryOnRails::Helpers::JQueryHelper
			ActionView::Base.send :include, JQueryOnRails::Helpers::JQueryHelper
		
			# Redefine the default sources so that we don't try to include prototype JS files.
			require 'action_view/helpers/asset_tag_helper'
			ActionView::Helpers::AssetTagHelper.class_eval do
			  remove_const :JAVASCRIPT_DEFAULT_SOURCES if const_defined? :JAVASCRIPT_DEFAULT_SOURCES
			  const_set :JAVASCRIPT_DEFAULT_SOURCES, %w/jquery rails/
			  reset_javascript_include_default
			end
		end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jquery_on_rails-0.2.2 lib/jquery_on_rails/railtie.rb