Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't a Rails 3.2.2 new application include lib/assets in the asset paths?

I recently wrote a blog post on the asset pipeline and learned that the folder lib/assets should be included in the asset paths list. If I create a brand new Rails app using 3.2.2, run the console and then run the command y Rails.application.config.assets.paths I don't see lib/assets. Shouldn't this be included by default?

Here's how I got there:

$ rails new example
$ cd example
$ rails c
>> y Rails.application.config.assets.paths
---
- /Users/eberry/Playground/example/app/assets/images
- /Users/eberry/Playground/example/app/assets/javascripts
- /Users/eberry/Playground/example/app/assets/stylesheets
- /Users/eberry/Playground/example/vendor/assets/javascripts
- /Users/eberry/Playground/example/vendor/assets/stylesheets
- /Users/eberry/.rvm/gems/ruby-1.9.2-p290/gems/jquery-rails-2.0.2/vendor/assets/javascripts
- /Users/eberry/.rvm/gems/ruby-1.9.2-p290/gems/coffee-rails-3.2.2/lib/assets/javascripts
=> nil
>> 

Any help would be greatly appreciated.

like image 589
coderberry Avatar asked Apr 25 '12 14:04

coderberry


3 Answers

I don't have Rails installed on this computer, but from the source reference it looks like lib/assets would never be included, but any subpaths would.

Try creating lib/assets/javascripts and see if that's included automatically.

like image 78
James Mason Avatar answered Sep 29 '22 16:09

James Mason


Do you have anything in any of the lib folders? I have one js file in my lib/assets/javascripts folder and when I check my asset paths, only that one path, ie lib/assets/javascripts/, is displayed, though not lib/assets/images or lib/assets/stylesheets, since I did not create those folders.

I'm on Rails 3.2.3.

like image 22
bambery Avatar answered Sep 29 '22 16:09

bambery


I had the same problem.

Put at least one file, for example in lib/assets/javascripts, then restart your app.

Now rails c, and Rails.application.config.assets.paths should contain lib/assets/javascripts.

like image 41
lakim Avatar answered Sep 29 '22 16:09

lakim