2012-07-20 32 views
0

當我嘗試在共享主機上部署Rails 3.2.6應用程序(在ruby 1.9.2中)時,我遇到了一個問題。rails3在生產中聲明管道問題

只是縮小好像它doenot承認jQuery的問題,我沒有在我的application.js下面的測試文件

// This is a manifest file that'll be compiled into application.js, which will include all the files 
// listed below. 
// 
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 
// 
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 
// the compiled file. 
// 
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD 
// GO AFTER THE REQUIRES BELOW. 
// 
//= require jquery 
//= require jquery_ujs 
//= require_tree . 

$(document).ready(function() { 
    alert("inside jquery") 
}) 
alert("outside jquery") 

所以,當頁面加載"outside jquery"警報來,但不「裏面的jQuery」

和這個工作在我的本地機器在生產模式(但沒有客運)

下面是我的production.rb(ENV文件)

Sees::Application.configure do 
    # Settings specified here will take precedence over those in config/application.rb 

    # Code is not reloaded between requests 
    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 = true 

    # 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 

    # Send deprecation notices to registered listeners 
    config.active_support.deprecation = :notify 

    # Log the query plan for queries taking more than this (works 
    # with SQLite, MySQL, and PostgreSQL) 
    # config.active_record.auto_explain_threshold_in_seconds = 0.5 
end 

我相信這是值得做的斷言管道在Rails3中,如果有一個人能幫助我這將是巨大的,在此先感謝

更新 - 我的寶石文件

source 'https://rubygems.org' 

gem 'rails', '3.2.6' 

# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

gem 'sqlite3' 

gem 'json' 

# 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' 

    # See https://github.com/sstephenson/execjs#readme for more supported runtimes 
    gem 'therubyracer', :platforms => :ruby 

    gem 'uglifier', '>= 1.0.3' 
end 

gem 'jquery-rails' 

# To use ActiveModel has_secure_password 
# gem 'bcrypt-ruby', '~> 3.0.0' 

# To use Jbuilder templates for JSON 
# gem 'jbuilder' 

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

# Deploy with Capistrano 
gem 'capistrano' 

# To use debugger 
# gem 'ruby-debug' 
# gem 'debugger' 

#authentication 
gem 'devise' 

#file upload 
gem 'paperclip' 

回答

0

jquery-rails寶石的資產組外bundle

+0

嗨Yasky感謝您的回答,它已經在外面斷言組。 #Gems僅用於資產,默認情況下不需要生產環境中的 #。 group:assets do gem'sass-rails','〜> 3.2.3' gem'coffee-rails','〜> 3.2.1' #請參閱https://github.com/sstephenson/execjs #readme更多支持運行時 寶石 'therubyracer':平臺=>:紅寶石 寶石 'uglifier', '> = 1.0.3' 結束 寶石 'jQuery的軌道' – sameera207 2012-07-20 21:35:19

+0

遺憾的格式,我更新這個問題 – sameera207 2012-07-20 21:35:57