File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 1
1
module Jquery
2
2
module Rails
3
3
4
- class Engine < ::Rails :: Engine
5
- config . before_configuration do
6
- require "jquery-rails/assert_select_jquery" if :: Rails . env . test?
7
- end
4
+ if ::Rails . version < "3.1"
5
+ require 'jquery-rails/railtie'
6
+ else
7
+ require 'jquery-rails/engine'
8
8
end
9
9
10
10
end
Original file line number Diff line number Diff line change
1
+ # Configure Rails 3.0 to use public/javascripts/jquery et al
2
+ module Jquery
3
+ module Rails
4
+
5
+ class Railtie < ::Rails ::Railtie
6
+ config . before_configuration do
7
+ require "jquery-rails/assert_select_jquery" if ::Rails . env . test?
8
+
9
+ if ::Rails . root . join ( "public/javascripts/jquery-ui.min.js" ) . exist?
10
+ jq_defaults = %w( jquery jquery-ui )
11
+ jq_defaults . map! { |a | a + ".min" } if ::Rails . env . production?
12
+ else
13
+ jq_defaults = ::Rails . env . production? ? %w( jquery.min ) : %w( jquery )
14
+ end
15
+
16
+ config . action_view . javascript_expansions [ :defaults ] = jq_defaults + %w( rails )
17
+ end
18
+ end
19
+
20
+ end
21
+ end
You can’t perform that action at this time.
0 commit comments