# Rails 3: problems with â€˜libâ€™ and â€˜requ ireâ€™

**URL:** <https://www.ruby-forum.com/t/rails-3-problems-with-a-liba-and-a-requ-irea/192726>\
**Category:** Rails\
**Created:** [August 4, 2010, 3:21pm UTC](https://www.ruby-forum.com/t/rails-3-problems-with-a-liba-and-a-requ-irea/192726 "2010-08-04T15:21:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![avsej](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f07891/32.png) [@avsej](https://www.ruby-forum.com/u/avsej)\
**Post date:** [August 4, 2010, 3:21pm UTC](https://www.ruby-forum.com/t/rails-3-problems-with-a-liba-and-a-requ-irea/192726/1 "2010-08-04T15:21:19Z")

</div>

Hi!

Ruby files from the lib directory don’t automaticaly loaded/required.  
I tried adding string:

config.autoload\_paths += %W(#{config.root}/lib)

to my application.rb file but it doesn’t work too.

Second problem with ‘require’ files (libs or modules). At the first  
request to the application necessary files includes. But at the  
following requests it doesn’t occur. Partially this problem can be  
decided if to use ‘include’ instead ‘require’ but it’s bad solution ☹

---

<div class="post-metadata">

**Author:** ![avsej](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f07891/32.png) [@avsej](https://www.ruby-forum.com/u/avsej)\
**Post date:** [August 5, 2010, 7:46pm UTC](https://www.ruby-forum.com/t/rails-3-problems-with-a-liba-and-a-requ-irea/192726/2 "2010-08-05T19:46:12Z")

</div>

Hi! I fixed this problems

> Ruby files from the lib directory don’t automaticaly loaded/required.  
> The problem consisted in wrong files name.

> Second problem with ‘require’ files (libs or modules). At the first  
> request to the application necessary files includes. But at the  
> following requests it doesn’t occur. Partially this problem can be  
> decided if to use ‘include’ instead ‘require’ but it’s bad solution ☹  
> It is necessary to create a file with needed requires in the  
> ‘initializers’ folder
