Class Caching Problem [was Newbie Question about Custom Clas


#1

So any other ideas as to why my custom class under app/models is being
cached even though all the caching is set to false in the
config/environments/* files? Currently I’m having to restart WEBrick
after EVERY change to the file. The controllers and views are
reloading just fine and not being cached. It’s just the custom class
I created that’s being cached.

Any ideas as to what I should try to get it to stop caching the class?

Thanks,

  • Brent

#2

Hi –

On Wed, 22 Mar 2006, Brent J. wrote:

So any other ideas as to why my custom class under app/models is being
cached even though all the caching is set to false in the
config/environments/* files? Currently I’m having to restart WEBrick
after EVERY change to the file. The controllers and views are
reloading just fine and not being cached. It’s just the custom class
I created that’s being cached.

Any ideas as to what I should try to get it to stop caching the class?

No, but I’m having the same issue. I don’t know that it’s
server-determined, but for what it’s worth you can add lighttpd to the
list of servers under which it happens :slight_smile:

David

  • Brent

Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


David A. Black (removed_email_address@domain.invalid)
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)

“Ruby for Rails” chapters now available
from Manning Early Access Program! http://www.manning.com/books/black


#3

No, but I’m having the same issue. I don’t know that it’s
server-determined, but for what it’s worth you can add lighttpd to the
list of servers under which it happens :slight_smile:

David

Shew, at least I know I’m not losing my mind then! I’ve grepped for
all occurences of the word “cach” to see if there’s any other file
which caching parameters and I’ve found nothing other than whats in
the environments directory.

Thanks for letting me know I’m not the only one!

  • Brent

#4

Brent,

I may be missing old history on this thread so sorry if I’m asking a
question that you’ve already covered:

you say “custom class”. Does your class inherit from
ActiveRecord::Base?

If not, and if you’re using Rails1.0 you won’t easily get class
reloading.

In edge-rails (and the upcoming Rails 1.1) there is a module-mixin
called “Reloadable” that will allow you to mark arbitrary classes as
reloadable so long as they conform to some file naming conventions.

HTH,
Trevor

Trevor S.
http://somethinglearned.com


#5

Aha! You’re correct, the class does not inherit from
ActiveRecord::Base. I am indeed using Rails 1.0, so I bet that’s the
problem.

Thanks for filling me in!

  • Brent

#6

On Mar 22, 2006, at 10:06 AM, Brent J. wrote:

Aha! You’re correct, the class does not inherit from
ActiveRecord::Base. I am indeed using Rails 1.0, so I bet that’s the
problem.

I got around this by using ‘require_dependency’ rather than ‘require’
when requiring the file with the custom classes. Seems to work fine
for most situations. Apparently this will be replaced in 1.1 with a
mixin.

HTH,

being

Thanks,
http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


Bob H. – blogs at <http://www.recursive.ca/
hutch/>
Recursive Design Inc. – http://www.recursive.ca/
Raconteur – http://www.raconteur.info/
xampl for Ruby – http://rubyforge.org/projects/xampl/