Sam Kong
Sam Kong

Reputation: 5810

Rails Asset Paths are different on different machine

I am developing a rals 3.2.8 application. I started it on my Mac and copied it to a linux machine. The linux machine gives an error line the following.

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

I checked Rails.application.config.assets.paths and realized that it's different on my Mac and the Linux. Did I miss something?

Thanks.

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

I found a weird thing. Even if my development env and design env (which I copied from config/environments/development.rb) are identical, Rails.application.config.assets.paths are different.

Here's a capture from my console.

[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 > 

What did I do wrong?

Sam

Upvotes: 0

Views: 338

Answers (2)

Sam Kong
Sam Kong

Reputation: 5810

I found how to fix it.

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 design)))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

I added 'design' to it.

It took me almost a whole day.

Sam

Upvotes: 0

Peter Duijnstee
Peter Duijnstee

Reputation: 3779

Since asset paths are defined by the application I can't imagine why the machine's operating system should have any effect on application configuration.

Apologies for the obvious question but you are using the same environment on both machines? (i.e. not production on one and development on the other?) That's the only possibility that springs to mind. You could try grep'ing for the different paths in your config directory as well. (e.g. grep strange_asset_path -r config)

Upvotes: 1

Related Questions