Reputation: 48511
I have in the lib directory following structure:
/lib/dir_a/dir_b/dir_c/
In dir_c
are stored images.
I am trying to load these images and display them in views. I have tried to set up the path to the images in views, but I got the 404 error.
So I did following: created a file in the initializers
folder and into this file I put:
Dir[Rails.root + 'lib/dir_a'].each do |file|
require file
end
For loading all content stored in the dir_a directory (which involves as subdirectories as files). But when I restarted server, I got this error:
...dependencies.rb:251:in `require': cannot load such file -- /Users/radek/rubydev/EDI/lib/brands (LoadError)
I also tried stuff like
Dir[Rails.root + 'lib/dir_a/'].each do |file|
or
Dir[Rails.root + 'lib/dir_a/**'].each do |file|
But none of those helped me.
Thus, is there any way to load a content from /lib directory and work with them in views?
Upvotes: 0
Views: 322