Forum: Ruby on Rails Model reloading problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Luciano B. (Guest)
on 2006-03-31 09:04
(Received via mailing list)
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
Alan F. (Guest)
on 2006-03-31 10:01
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. :-)

Alan
Luciano B. (Guest)
on 2006-03-31 10:20
(Received via mailing list)
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
Trevor S. (Guest)
on 2006-03-31 10:48
(Received via mailing list)
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. (Guest)
on 2006-03-31 11:50
(Received via mailing list)
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
Alan F. (Guest)
on 2006-04-01 01:19
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
This topic is locked and can not be replied to.