# Code changes are ignored due to code minor ver. were cached

**URL:** <https://www.ruby-forum.com/t/code-changes-are-ignored-due-to-code-minor-ver-were-cached/153543>\
**Category:** Rails\
**Created:** [November 18, 2008, 4:04pm UTC](https://www.ruby-forum.com/t/code-changes-are-ignored-due-to-code-minor-ver-were-cached/153543 "2008-11-18T16:04:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [November 18, 2008, 4:04pm UTC](https://www.ruby-forum.com/t/code-changes-are-ignored-due-to-code-minor-ver-were-cached/153543/1 "2008-11-18T16:04:58Z")

</div>

Hi there!  
I study Ruby on Rails and met a problem.

I placed a class definition code for class which is NOT a Model into  
separate file, assume MyToolClass.rb

Then I started working on controller code and required ‘MyToolClass’

While working on controller code I also corrected some code in  
MyToolClass.rb, but it seemed, that changes in MyTooolClass.rb were  
ignored by Rails until I had restarted Mongrel.

Q#1: Please write to me how can I tell Rails to reread source files  
those were changed after last use.

Q#:2 Where to place files like MyToolclass.rb, which are nither Model,  
nor Controller?

Thank you for your attention.

---

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [November 18, 2008, 5:03pm UTC](https://www.ruby-forum.com/t/code-changes-are-ignored-due-to-code-minor-ver-were-cached/153543/2 "2008-11-18T17:03:55Z")

</div>

On Nov 18, 3:04 pm, Zhoran T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi there!  
> I study Ruby on Rails and met a problem.
> 
> I placed a class definition code for class which is NOT a Model into  
> separate file, assume MyToolClass.rb
> 
> Then I started working on controller code and required ‘MyToolClass’

use require\_dependency instead of require.

Fred

---

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [November 18, 2008, 5:54pm UTC](https://www.ruby-forum.com/t/code-changes-are-ignored-due-to-code-minor-ver-were-cached/153543/3 "2008-11-18T17:54:59Z")

</div>

On Nov 18, 10:03 am, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> use require\_dependency instead of require.
> 
> Fred

But if the file name follows conventions (so a class named MyToolClass  
would go in a file named app/models/my\_tool\_class.rb or lib/  
my\_tool\_class.rb), then no require or require\_dependency should be  
needed and code changes will be automatically reloaded in development  
mode.

If you’re not following naming conventions, then do as Fred  
suggests 🙂

Jeff

[www.purpleworkshops.com](http://www.purpleworkshops.com)

---

<div class="post-metadata">

**Author:** ![zloy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/b4bc9f/32.png) [@zloy](https://www.ruby-forum.com/u/zloy)\
**Post date:** [November 20, 2008, 11:14am UTC](https://www.ruby-forum.com/t/code-changes-are-ignored-due-to-code-minor-ver-were-cached/153543/4 "2008-11-20T11:14:44Z")

</div>

Jeff C. wrote:

> On Nov 18, 10:03ï¿½am, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > use require\_dependency instead of require.
> > 
> > Fred
> 
> But if the file name follows conventions (so a class named MyToolClass  
> would go in a file named app/models/my\_tool\_class.rb or lib/  
> my\_tool\_class.rb), then no require or require\_dependency should be  
> needed and code changes will be automatically reloaded in development  
> mode.
> 
> If you’re not following naming conventions, then do as Fred  
> suggests 🙂
> 
> Jeff
> 
> [www.purpleworkshops.com](http://www.purpleworkshops.com)

Many thanks, guys!  
I put each my class into it’s own file in app’s lib directory following  
naming conventions and Voila! After that every change in these files are  
incorporated immediately without require or require\_dependency calls.  
That’s great!
