javascript - Rails jquery can not load in any event -
i have tried solution in stackoverflow still have trouble jquery load on rails.it works on localhost not on heroku.
so, here application.js
file
//= require jquery //= require bootstrap //= require jquery_ujs //= require_tree .
here application.css
file
*= require_tree . */
here gem file;
source 'https://rubygems.org' gem 'rails', '4.2.0' gem 'json', '~> 1.8.2' gem 'bcrypt', '3.1.7' gem 'bootstrap-sass', '3.2.0.0' gem 'sass-rails', '5.0.1' gem 'uglifier', '2.5.3' gem 'coffee-rails', '4.1.0' gem 'jquery-rails', '4.0.3' #//= require turbolinks assets gem 'turbolinks', '2.3.0' gem 'jbuilder', '2.2.3' gem 'sdoc', '0.4.0', group: :doc gem "mailboxer" gem "select2-rails" group :development, :test gem 'sqlite3', '1.3.9' gem 'byebug', '3.4.0' gem 'web-console', '2.0.0.beta3' gem 'spring', '1.1.3' end group :test gem 'minitest-reporters', '1.0.5' gem 'mini_backtrace', '0.1.3' gem 'guard-minitest', '2.3.1' end group :production gem 'pg', '0.17.1' gem 'rails_12factor', '0.0.2' end
and here application.html.erb
<!doctype html> <html> <head> <title>...</title> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="initial-scale = 1.0,maximum-scale = 1.0" /> <%= javascript_include_tag 'application', 'data-turbolinks-track' => false %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => false %> <%= csrf_meta_tags %> </head> <body> <%= yield %> </body> </html>
the funny thing is, console not give error jquery slider not work. , of css changes did not reflect heroku (i did precompile)
since heroku pre-compiles default, i'd error have "polluted" precompiled assets (when have maybe 8-10 application.js
variants in public/assets
).
i - of course - wrong , happily remove post, may wish try:
$ rake assets:clean $ git add . $ git commit -a -m "assets" $ git push heroku master $ heroku rake assets:clean
Comments
Post a Comment