Permalink
Browse files

Update API.

  • Loading branch information...
1 parent ca016ce commit 84a3670769987cd20f5c6b19171cdc92905c7d43 @josevalim josevalim committed Dec 20, 2011
Showing with 3 additions and 36 deletions.
  1. +1 −5 lib/jquery/rails.rb
  2. +2 −6 lib/jquery/rails/engine.rb
  3. +0 −25 lib/jquery/rails/railtie.rb
View
@@ -2,11 +2,7 @@ module Jquery
module Rails
PROTOTYPE_JS = %w{prototype effects dragdrop controls}
- if ::Rails.version < "3.1"
- require 'jquery/rails/railtie'
- else
- require 'jquery/rails/engine'
- end
+ require 'jquery/rails/engine'
require 'jquery/rails/version'
end
end
@@ -1,12 +1,8 @@
-# Configure Rails 3.1 to have assert_select_jquery() in tests
+require "jquery/assert_select" if ::Rails.env.test?
+
module Jquery
module Rails
-
class Engine < ::Rails::Engine
- config.before_configuration do
- require "jquery/assert_select" if ::Rails.env.test?
- end
end
-
end
end
@@ -1,25 +0,0 @@
-# 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

0 comments on commit 84a3670

Please sign in to comment.