JQuery没有定义,也没有在Ruby on Rails应用程序中的application.js中加载

时间:2016-03-03 14:27:42

标签: jquery ruby-on-rails ruby

我在本地计算机上安装了一个在生产中运行的RoR应用程序。该应用程序在生产和其他本地计算机上运行良好,但我有一个不能正确加载jquery。

该应用程序适用于Rails 3.1.0和Ruby 1.9.3-p547。该应用程序也使用apache tomcat 6和Solr。操作系统是Ubuntu 15.10。

问题是application.js.erb显然编译得不好,因为当我检查DevTools中的代码时,它不会用// =编译部分。 devTools控制台告诉我,JQuery没有定义。

我的 Gemfile

    # encoding: utf-8
source 'http://rubygems.org'

if RUBY_VERSION =~ /1.9/
  Encoding.default_external = Encoding::UTF_8
  Encoding.default_internal = Encoding::UTF_8
end

gem 'rails', '3.1.0'

gem 'rake', '0.9.2.2'
gem 'rack', '1.3.6'


# Gems for database and indexing data
gem 'pg'

gem 'sunspot_rails','2.0.0'
gem 'sunspot_solr', '2.0.0'

gem 'redis'
gem 'redis-namespace'
gem 'impressionist', '1.3.1'

# Gems for behaviors 
gem 'acts_as_tree', '1.2.0'
gem "eventmachine", '1.0.9.1'


gem 'nokogiri', '1.6.1'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails', '~> 3.1.0'
  gem 'coffee-rails', '~> 3.1.0'
  gem 'uglifier'
end


# Gems for presentation

gem 'gon', "4.1.1"              # Data to your js files (https://github.com/gazay/gon)
gem 'friendly_id'               # "Swiss Army bulldozer" of slugging and permalink plugins (http://github.com/norman/friendly_id)
gem 'jquery-rails', "1.0.19"    # jQuery and the jQuery-ujs driver (http://rubygems.org/gems/jquery-rails)
gem 'draper', '0.12'            # Draper adds a nicely-separated object-oriented layer of presentation logic (http://github.com/drapergem/draper)
gem 'mustache', "0.99.5"        # Mustache is a framework-agnostic way to render logic-free views (http://github.com/defunkt/mustache)
gem "paperclip", "2.7.0"        # Easy upload management for ActiveRecord (https://github.com/thoughtbot/paperclip)
gem "progress_bar"              # Give people feedback about long-running tasks (http://www.github.com/paul/progress_bar)
gem "js-routes", "0.7.5"        # Generates javascript file that defines all Rails named routes as javascript helpers (https://github.com/railsware/js-routes)
gem "useragent"                 # Ruby library that parses and compares HTTP User Agents.
gem 'bcrypt-ruby', "~> 3.0.0"

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
gem 'capistrano', "2.12.0"
gem 'rvm-capistrano', "1.2.7",  require: false

# Mail sending
gem "mail"                      # Internet library for Ruby that is designed to handle emails generation (https://github.com/mikel/mail)
gem "roadie", '~> 2.4'                    # Roadie tries to make sending HTML emails a little less painful (https://github.com/Mange/roadie)

group :test do

  gem 'turn', :require => false # Turn provides a set of alternative runners for MiniTest, both colorful and informative (http://github.com/TwP/turn)
end

group :development do
  gem 'rails-dev-tweaks', '~> 0.6.1'
  #gem 'jazz_hands', '~> 0.5.1'
  #gem 'binding_of_caller', "0.6.7"
  #gem "better_errors", "0.3.0"           # Provides a better error page for Rails and other Rack apps. (https://github.com/charliesome/better_errors)
  gem 'letter_opener'
end


#gem 'thin'
gem "cancan", "~> 1.6.7"

gem "whenever", :require => false
gem "delayed_job_active_record", "0.3.3"
gem "daemons", "1.1.9"
gem "prawn", '1.0.0.rc1'
gem "pdfkit", "~> 0.5.4"
gem "wkhtmltopdf-binary", "~> 0.9.9.1"
gem "cocaine", "0.3.2"
gem "rubyzip"
gem 'net-ssh', '2.7.0'

gem 'newrelic_rpm'

#Gem Json Parser
gem "json"

#Gem mailchip
gem "hominid"

#Gem Mailjet
gem "mailjet"

#Gem Utf8 invalid caracter cleaner
gem 'utf8-cleaner'

#Para paginación
gem "kaminari", "0.15.0"

gem 'dalli'

gem 'roo'
gem "spreadsheet", "~> 0.9.7"
gem 'sendgrid-rails', '~> 2.0'
gem 'color'

Application.js.erb

// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery_ujs
//= require jquery
//= require_directory .
//
//= require mustache
//= require qTip/jquery.qtip
//= require plugin/jquery.metadata
//= require plugin/jquery.inputhintoverlay
//= require video/projekktor.min
//= require plugin/jquery.jmp3
//= require plugin/jquery.fancybox.pack
//= require plugin/jquery.fancybox-buttons
//= require plugin/jquery.fancybox-thumbs
//= require plugin/jquery.blockUI
//= require plugin/jquery.notify.min
//= require plugin/jquery.mousewheel
//= require perfectScrollbar/perfect-scrollbar

Thanx提前!!

0 个答案:

没有答案