Rails资产路径在不同的机器上是不同的

时间:2012-09-17 07:34:56

标签: ruby-on-rails asset-pipeline

我正在开发一个ral 3.2.8应用程序。我在Mac上启动它并将其复制到linux机器上。 linux机器给出了以下错误行。

couldn't find file 'jquery.ui.all'

我检查了Rails.application.config.assets.paths并意识到它在我的Mac和Linux上有所不同。我错过了什么吗?

感谢。

=========== UPDATE ============

我发现了一件奇怪的事。即使我的开发环境和设计环境(我从config / environments / development.rb复制)是相同的,Rails.application.config.assets.paths也是不同的。

这是从我的控制台捕获的。

[ssk-MBP]~/dev/test$ r c
Loading development environment (Rails 3.2.8)
1.8.7 :001 > Rails.application.config.assets.paths
 => ["/Users/ssk/dev/dentisusa/app/assets/images", "/Users/ssk/dev/dentisusa/app/assets/javascripts", "/Users/ssk/dev/dentisusa/app/assets/stylesheets", "/Users/ssk/dev/dentisusa/vendor/assets/javascripts", "/Users/ssk/dev/dentisusa/vendor/assets/stylesheets", "/Users/ssk/.rvm/gems/ree-1.8.7-2011.03@dentisusa/gems/jquery-rails-2.1.2/vendor/assets/javascripts", "/Users/ssk/.rvm/gems/ree-1.8.7-2011.03@dentisusa/gems/underscore-rails-1.3.1/vendor/assets/javascripts", "/Users/ssk/.rvm/gems/ree-1.8.7-2011.03@dentisusa/gems/bootstrap-sass-2.1.0.0/vendor/assets/images", "/Users/ssk/.rvm/gems/ree-1.8.7-2011.03@dentisusa/gems/bootstrap-sass-2.1.0.0/vendor/assets/javascripts", "/Users/ssk/.rvm/gems/ree-1.8.7-2011.03@dentisusa/gems/bootstrap-sass-2.1.0.0/vendor/assets/stylesheets", "/Users/ssk/.rvm/gems/ree-1.8.7-2011.03@dentisusa/gems/coffee-rails-3.2.2/lib/assets/javascripts", #<Pathname:/Users/ssk/dev/dentisusa/vendor/bundle/ruby/1.8/gems/jquery-ui-rails-2.0.0/vendor/assets/stylesheets>] 
1.8.7 :002 > exit
[ssk-MBP]~/dev/test$ r c design
Loading design environment (Rails 3.2.8)
1.8.7 :001 > Rails.application.config.assets.paths
 => ["/Users/ssk/dev/dentisusa/app/assets/images", "/Users/ssk/dev/dentisusa/app/assets/javascripts", "/Users/ssk/dev/dentisusa/app/assets/stylesheets", "/Users/ssk/dev/dentisusa/vendor/assets/javascripts", "/Users/ssk/dev/dentisusa/vendor/assets/stylesheets", "/Users/ssk/.rvm/gems/ree-1.8.7-2011.03@dentisusa/gems/jquery-rails-2.1.2/vendor/assets/javascripts", #<Pathname:/Users/ssk/dev/dentisusa/vendor/bundle/ruby/1.8/gems/jquery-ui-rails-2.0.0/vendor/assets/stylesheets>] 
1.8.7 :002 > 

我做错了什么?

萨姆

1 个答案:

答案 0 :(得分:0)

我找到了解决方法。

配置/ application.rb中

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require(*Rails.groups(:assets => %w(development test design)))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

我在其中添加了'design'。

我花了差不多一整天。

萨姆