Model reloading problem

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

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

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. [email protected] wrote:

FYI : in the development. rb i desabled class cache with
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Luciano B.

email: [email protected]
Tél: 06 61 84 51 00
Fax: 04 92 72 65 91

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

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

Many thanks, it works.

Thank you Trevor

On 3/31/06, Trevor S. [email protected] 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: [email protected]
Tél: 06 61 84 51 00
Fax: 04 92 72 65 91