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.
588b8a8cef3c8231ff4cf6948d5e1991?d=identicon&s=25 Luciano Broussal (Guest)
on 2006-03-31 07: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
Cbfc2607802c71ca055be829f9906858?d=identicon&s=25 Alan Francis (Guest)
on 2006-03-31 08:01
Luciano Broussal 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
588b8a8cef3c8231ff4cf6948d5e1991?d=identicon&s=25 Luciano Broussal (Guest)
on 2006-03-31 08: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 Francis <alancfrancis@gasil.com> wrote:
> > FYI : in the development. rb i desabled class cache  with
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>



--
----------------------------------
Luciano Broussal

email: luciano.broussal@gmail.com
Tél: 06 61 84 51 00
Fax: 04 92 72 65 91
27c170f482104299af279902be0a9c26?d=identicon&s=25 Trevor Squires (Guest)
on 2006-03-31 08: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 Squires
http://somethinglearned.com
588b8a8cef3c8231ff4cf6948d5e1991?d=identicon&s=25 Luciano Broussal (Guest)
on 2006-03-31 09:50
(Received via mailing list)
Many thanks, it works.

Thank you Trevor


On 3/31/06, Trevor Squires <trevor@protocool.com> wrote:
> require_dependency 'toto'
> Trevor
> > I've a model class Toto in the model directory.
> >
> http://lists.rubyonrails.org/mailman/listinfo/rails
>



--
----------------------------------
Luciano Broussal

email: luciano.broussal@gmail.com
Tél: 06 61 84 51 00
Fax: 04 92 72 65 91
4daf0b71d5d9a3882e583c0e72eaf5dc?d=identicon&s=25 Alan Francis (Guest)
on 2006-03-31 23:19
Luciano Broussal 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.