I have been developing a rails app for a week now. I use jquery-rails gem to use jQuery and everything was working fine. But today, when I started the development server, jQuery just wasn't loading. The console gave the error jQuery not defined
and $ not defined
and so forth. So I checked if the jQuery files are being included and they were. But when I clicked on the link to the jquery.js
file, it contained only the following.
(function() {
}).call(this);
jQuery just isnt working..
This is how I have required the js libraries:
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require bootstrap-datepicker/core
//= require_tree .
I have tried interchanging bootstrap and jQuery and even tried removing jQuery and using only bootstrap. Nothing seems to be working.
The funny part is that it was working perfectly till last night!! And I don't remember adding or removing any js libs. I was only writing Javascript code. So I have no clue as to what went wrong overnight.
The only thing I haven't tried is serving jQuery from a CDN. But that is not an option considering where my app is going to be deployed.
Please help.
My Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'will_paginate', '~> 3.0.beta'
gem 'will_paginate-bootstrap'
#gem 'sqlite3'
gem 'mysql2'
#gem 'devise'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'twitter-bootstrap-rails'
gem 'less-rails'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'bootstrap-datepicker-rails'
gem 'libv8'
Thanks in advance.