Ruby on rails 使用rails 3.2.11在heroku产品中未加载Js文件

Ruby on rails 使用rails 3.2.11在heroku产品中未加载Js文件,ruby-on-rails,ruby-on-rails-3,asset-pipeline,Ruby On Rails,Ruby On Rails 3,Asset Pipeline,我的rails应用程序在localhost中使用所有js文件,但当我在heroku产品中运行时,它不会加载任何js文件吗 config/application.rb config.cache_classes=true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false config.action_controller.perform_

我的rails应用程序在localhost中使用所有js文件,但当我在heroku产品中运行时,它不会加载任何js文件吗

config/application.rb config.cache_classes=true

# Full error reports are disabled and caching is turned on
config.consider_all_requests_local       = false
config.action_controller.perform_caching = true

# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false

# Compress JavaScripts and CSS
config.assets.compress = true

# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true

# Generate digests for assets URLs
config.assets.digest = true

# Defaults to nil and saved in location specified by config.assets.prefix
# config.assets.manifest = YOUR_PATH

# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx

# Force all access to the app over SSL, use Strict-Transport-Security, and use secure
cookies.
# config.force_ssl = true

# See everything in the log (default is :info)
# config.log_level = :debug

# Prepend all log lines with the following tags
# config.log_tags = [ :subdomain, :uuid ]

# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)

# Use a different cache store in production
# config.cache_store = :mem_cache_store

# Enable serving of images, stylesheets, and JavaScripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"

# Precompile additional assets (application.js, application.css, and all non-JS/CSS are
already added)
# config.assets.precompile += %w( search.js )

# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false

# Enable threaded mode
# config.threadsafe!

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true

config.assets.debug = false
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
config/environment.rb

config.whiny_nils = true

# Show full error reports and disable caching
config.consider_all_requests_local       = true
config.action_controller.perform_caching = false

# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false

# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log

# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin


# Do not compress assets
config.assets.compress = false

# Expands the lines which load the assets
config.assets.debug = true
config.assets.enabled = true
应用程序.rb

config.whiny_nils = true

# Show full error reports and disable caching
config.consider_all_requests_local       = true
config.action_controller.perform_caching = false

# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false

# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log

# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin


# Do not compress assets
config.assets.compress = false

# Expands the lines which load the assets
config.assets.debug = true
config.assets.enabled = true
application.js

//= require jquery

//= require jquery_ujs

//= require jquery-ui

//= require twitter/bootstrap

//= require_tree .
Gem文件

source 'https://rubygems.org'

gem 'rails', '3.2.11'
gem 'rest-client' , :require => 'rest_client'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
#gem 'twitter-bootstrap-rails'
gem 'execjs'
gem 'therubyracer'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem "less-rails"
gem 'sass-rails',   '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'twitter-bootstrap-rails'
 # See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'

end
gem "paperclip", "~> 3.0"
gem 'jquery-rails'
所以当我在我的html头标签中运行heroku时

<head>
<title>Admin70mmiq</title>
<link type="text/css" rel="stylesheet" media="all" href="/assets/application- 
 7bf1caf8d9df45f41b2e2de526e0a07e.css">

<script type="text/javascript" src="/assets/application-
561ebefa444229c0b9721488348e73eb.js">
<meta name="csrf-param" content="authenticity_token">
<meta name="csrf-token" content="zadsH75r/3ZNXRTijXuw7LJDNAflL/9J3DzDZJG9yi4=">
</head>

Admin70mmiq

资产管道将所有js文件压缩为一个名为application.js的文件,该文件在HTML中显示为
/assets/application-561ebefa444229c0b9721488348e73eb.js
hi budy请在部署到heroku之前对文件进行以下更改

------environment.rb-----

------Production.rb------如果有任何新的js或css创建

config.assets.compile = ['*.js', '*.css']
config.active_support.deprecation = :silence
-------application.rb-------

我在部署heroku时使用了这个步骤,请确保您使用“postgres”数据库和“瘦”服务器,希望您能够解决这个问题。
在GemFile two gem for Heroku:postgres,thin中,我没有在您的GemFile中看到此gem。

这里的问题是,我已经在我的html.erb文件中编写了脚本,所以在运行应用程序后,当我单击按钮时,它不会调用任何函数。我的意思是,我已经在show.html.erb$(document.ready)中编写了类似这样的代码(function(){var counter=2;$(“#addButton”)。单击(函数(){}因此,当我点击按钮时,这不叫firebug,这不显示任何错误,但当我在chrome上运行时,这显示了一些错误,但这是在本地工作的。错误是未捕获类型错误:无法读取未定义应用程序的属性“fileupload”-561ebefa444229c0b9721488348e73eb.js:287未捕获类型错误:对象[Object Object]没有方法“fileupload”主页:40加载资源失败:服务器响应状态为404加载资源失败:服务器响应状态为404(未找到),因此这就是错误。请将您的qs框定为特定于模式。同时查看您是否解决了此问题????