After installing jQuery on Rails (jRails) i noticed that the update task just kept overwriting my jquery.js with an older version. Effectively downgrading it…
So here is a real update task, execute it with rake update:jquery
#lib/tasks/jquery.rake
namespace :update do
desc "Download recent jQuery javascripts to public/javascripts"
task :jquery => :environment do
puts "Downloading files..."
files = {
'jquery.js'=>'http://code.jquery.com/jquery-latest.min.js',
}
require 'open-uri'
files.each do |local,remote|
f = File.open "#{js_dir}/#{local}", 'w' do |f|
f.write open(remote).read
end
puts "downloaded #{local} successfully."
end
puts "all files downloaded successfully."
end
def js_dir
ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR
end
end
PS: If the bleeding edge breaks anything you can get your old version back by jrails:update:javascripts
The other jquery libaries(fx,ui) are missing atm, since i am just using jquery on its own. If you know an update site, please drop a comment.