View Question
Vote on questions you’d like to see answered by the expert contributors
Signup to ask questions or vote for the questions you’d like to see answered.
Signup
How do I set up rails 3 to use jquery instead of prototype, ideally so the default javascript tag references jquery?
Asked May 05, 2010
Answer
You need to do two things. First, remove the default JavaScript files from public/javascripts and replace them with jquery.js from http://code.jquery.com/jquery-1.4.2.min.js (as jquery.js) and rails.js from http://github.com/rails/jquery-ujs/raw/59dd91d945570391f905b1e40444e5921dbc2b8f/src/rails.js.
Next, do the following in an initializer
module ActionView::Helpers remove_const :JAVASCRIPT_DEFAULT_SOURCES JAVASCRIPT_DEFAULT_SOURCES = %w(jquery.js rails.js) reset_javascript_include_default end
Answered May 09, 2010