Hi When i change my classes in the LIB folder they are not updating on the server. My server is in development mode. Any ideas why? Any help is appreciated Thanks, Chris
on 2006-05-08 14:11
on 2006-05-08 14:30
You need to include Reloadable in any classes that you want reloaded with each request. Some classes, like ActiveRecord, include this already. class MyClass include Reloadable end -Jonny.
on 2006-05-08 14:48
Thanks Jonny. It seems a strange to have to do. Surely in development mode it should reload all your classes on each request? is this not the point of development mode? So, i have to inlude "include Reloadable" in the classes i want to reload while i am developing. And then when i go into production mode i will remove the code. Seems plain wrong.
on 2006-05-08 14:58
Chris R. wrote: > Thanks Jonny. > > It seems a strange to have to do. Surely in development mode it should > reload all your classes on each request? is this not the point of > development mode? > > So, i have to inlude "include Reloadable" in the classes i want to > reload while i am developing. And then when i go into production mode i > will remove the code. Seems plain wrong. Model files can only reload becasue they inherit from ActiveRecord::Base, to Rails knows about them, but it doesn't know about files that don't inherit from that. J`ey http://www.eachmapinject.com
on 2006-05-08 16:45
I don't know enough about it to tell you why Rails doesn't simply remove everything and start again, but I'm sure there are reasons. You don't need to remove the 'include Reloadable' line when in production. The code which reloads the classes simply isn't called when in production. You can remove it if you want, but you don't have to. -Jonny.
on 2006-05-08 17:48
Imagine a file in your lib folder that had this in it: class Scary File.delete "/something/important.cfg" end ..or class Spam MyMailModel.deliver_spam end You'd want to be pretty sure you wanted to reload those automatically before letting it happen.