6

我将 config/environments/development.rb 复制到 config/environments/ci.rb。

当我使用 RAILS_ENV=development 运行时,资产搜索路径包括我的 gem 供应商目录,尤其是 jquery-ui-rails。但是,当我使用 RAILS_ENV=ci 运行时,它不会。

从控制台,Rails.application.config.assets.paths 评估为以下开发

irb(main):002:0> Rails.application.config.assets.paths
=> ["/var/www/ci/conflux/app/assets/images",
  "/var/www/ci/conflux/app/assets/javascripts",
  "/var/www/ci/conflux/app/assets/stylesheets",
  "/var/www/ci/conflux/vendor/assets/stylesheets",
  "/opt/comcast/ruby1.9.3/lib/ruby/gems/1.9.1/gems/jquery-rails-1.0.19/vendor/assets/javascripts",
  "/opt/comcast/ruby1.9.3/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-1.0.0/vendor/assets/images",
  "/opt/comcast/ruby1.9.3/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-1.0.0/vendor/assets/javascripts",
  "/opt/comcast/ruby1.9.3/lib/ruby/gems/1.9.1/gems/jquery-ui-rails-1.0.0/vendor/assets/stylesheets"]

但对于 ci 我只得到以下内容:

irb(main):002:0> Rails.application.config.assets.paths
=> ["/var/www/ci/conflux/app/assets/images",
  "/var/www/ci/conflux/app/assets/javascripts",
  "/var/www/ci/conflux/app/assets/stylesheets",
  "/var/www/ci/conflux/vendor/assets/stylesheets",
  "/opt/comcast/ruby1.9.3/lib/ruby/gems/1.9.1/gems/jquery-rails-1.0.19/vendor/assets/javascripts"]
4

2 回答 2

5

您是否已将 ci 环境添加到 中config/application.rb

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require(*Rails.groups(:assets => %w(development test ci)))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end
于 2012-10-22T22:37:39.683 回答
0

我认为@mccannf 有正确的答案,但如果不是问题,您是否已将 jquery-ui-rails gem 添加到ci组中Gemfile

于 2012-10-28T09:47:05.750 回答