问题
I copied config/environments/development.rb to config/environments/ci.rb.
When I run with RAILS_ENV=development, the asset search path includes my gem vendor directories, in particular for jquery-ui-rails. However, when I run with RAILS_ENV=ci it does not.
From the console, Rails.application.config.assets.paths evaluates to the following with development
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"]
but for ci I only get the following:
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"]
回答1:
Have you added the ci environment into 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
回答2:
I think @mccannf has the right answer but if it isn't the problem, have you added the jquery-ui-rails gem to the the ci
group into Gemfile
?
来源:https://stackoverflow.com/questions/12963106/copy-of-environments-development-asset-path-cannot-find-jquery-ui-rails-in-gems