Sha256: e1013d30273a9221875e7f8339540ea709bf4a31188366ad3c6ef4542233224d

Contents?: true

Size: 938 Bytes

Versions: 11

Compression:

Stored size: 938 Bytes

Contents

# Configure Rails 3.0 to use public/javascripts/jquery et al
module Jquery
  module Rails

    class Railtie < ::Rails::Railtie
      config.before_configuration do
        require "jquery/assert_select" if ::Rails.env.test?

        if ::Rails.root.join("public/javascripts/jquery-ui.min.js").exist?
          jq_defaults = %w(jquery jquery-ui)
          jq_defaults.map!{|a| a + ".min" } if ::Rails.env.production?
        else
          jq_defaults = ::Rails.env.production? ? %w(jquery.min) : %w(jquery)
        end

        # Merge the jQuery scripts, remove the Prototype defaults and finally add 'jquery_ujs'
        # at the end, because load order is important
        config.action_view.javascript_expansions[:defaults] -= PROTOTYPE_JS + ['rails']
        config.action_view.javascript_expansions[:defaults] |= jq_defaults
        config.action_view.javascript_expansions[:defaults] << 'jquery_ujs'
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
cloudfoundry-jquery-rails-1.0.19.1 lib/jquery/rails/railtie.rb
jquery-rails-1.0.19 lib/jquery/rails/railtie.rb
jquery-rails-1.0.18 lib/jquery/rails/railtie.rb
jquery-rails-1.0.17 lib/jquery/rails/railtie.rb
jquery-rails-1.0.16 lib/jquery/rails/railtie.rb
jquery-rails-1.0.15 lib/jquery/rails/railtie.rb
jquery-rails-1.0.14 lib/jquery/rails/railtie.rb
jquery-rails-1.0.13 lib/jquery/rails/railtie.rb
jquery-rails-1.0.12 lib/jquery/rails/railtie.rb
jquery-rails-1.0.11 lib/jquery/rails/railtie.rb
jquery-rails-1.0.10 lib/jquery/rails/railtie.rb