Sha256: 1646b59dc7c23ea66aaa73a4cd5df04eb4a621526c0f5779205d8757d2f9b5b6

Contents?: true

Size: 933 Bytes

Versions: 1

Compression:

Stored size: 933 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 'rails'
        # 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

1 entries across 1 versions & 1 rubygems

Version Path
jquery-rails_vho-0.0.1 lib/jquery/rails/railtie.rb