Hi! When accessing a drb server from within a Rails application, where the drb server returns an instance of a class that is available in app/models/, drb/Rails does not require/load the model file. Currently I need to explicitly require the model file in my controller and/or view in order to make the model class available to drb. It seems the way drb requests a class does not work with the way Rails implements the autoloading. Is there an easy solution besides simply requiring all models by default? I don''t want drb to return proxy objects and I don''t want to use backgroundrb either. bye, Tobias --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Tobi wrote:> in order to make the model class available to drb. It seems the way drb > requests a class does not work with the way Rails implements the > autoloading. >It seems, Marshal.load() does not trigger const_missing(). I''ve finally decided to make a small change to drb: http://pastie.caboo.se/50958 It simply catches the ArgumentException raised by Marshal.load, calls DRb.auto_require() and retries the unmarshalling. This way in my client and server code I simply can do something like: def DRb.auto_require(name) begin require(File.dirname(__FILE__) + ''/../app/models/'' + Inflector.underscore(name)) return true rescue LoadError return false end end Tobias --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---