Model reloading problem


#1

Hi all,

I’ve a model class Toto in the model directory.

I don’t understand why i have to restarts WebBrick to view changes i
make
in this class

FYI : in the development. rb i desabled class cache with

config.cache_classes = false

Regards

Luciano


#2

Luciano B. wrote:

Hi all,

I’ve a model class Toto in the model directory.

I don’t understand why i have to restarts WebBrick to view changes i
make
in this class

FYI : in the development. rb i desabled class cache with

config.cache_classes = false

I believe you may have just answered your own question. :slight_smile:

Alan


#3

Thx for your response

But my environement file include

config.cache_classes = false

This force reloading no ???

but the class is not reloaded unless i restart webbrick .

Have you an other idea

Thanks by advance

On 3/31/06, Alan F. removed_email_address@domain.invalid wrote:

FYI : in the development. rb i desabled class cache with
Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Luciano B.

email: removed_email_address@domain.invalid
Tél: 06 61 84 51 00
Fax: 04 92 72 65 91


#4

Hi,

does your model inherit from ActiveRecord::Base? If it doesn’t then
it won’t get reloaded automatically and you’ll have to do a little
extra work:

In rails 1.0 you can put this into your app/controllers/
application.rb file:

require_dependency ‘toto’

And in rails 1.1 you can use the Reloadable mixin. So in app/models/
toto.rb you have:

class Toto
include Reloadable

the rest of your stuff here

end

HTH,
Trevor

Trevor S.
http://somethinglearned.com


#5

Luciano B. wrote:

Thx for your response

But my environement file include

config.cache_classes = false

Doh! Apologies for a head full of mince.

Alan


#6

Many thanks, it works.

Thank you Trevor

On 3/31/06, Trevor S. removed_email_address@domain.invalid wrote:

require_dependency ‘toto’
Trevor

I’ve a model class Toto in the model directory.

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

Luciano B.

email: removed_email_address@domain.invalid
Tél: 06 61 84 51 00
Fax: 04 92 72 65 91