From: Bob Showalter Date: 2006-01-26T02:23:14+09:00 Subject: Re: DRb and ActiveRecord Ezra Zygmuntowicz wrote: > Friends- Advance warning: I am not a drb or ActiveRecord expert. I'm not much of an expert on anything, come to think of it :-) > > I am trying to make a drb server publish an ActiveRecord model so > it can be used by remote clients. > ... > class RemoteRecord < ActiveRecord::Base You need to make this class undumped: include DRb::DRbUndumped > end > > DRb.start_service("druby://:3500", RemoteRecord) > puts DRb.uri > DRb.thread.join > -------------------------------------- > And my irb session trying to access the remote model. > ... > irb(main):006:0> test = DRbObject.new(nil, 'druby://ezra.local:3500') > => # > > irb(main):009:0> test.create(:title => 'Foo', :desc => 'Bar') > => # \"\010Bar", @name="RemoteRecord"> DRbUnknown is your clue here. See: http://www.ruby-doc.org/stdlib/libdoc/drb/rdoc/classes/DRb/DRbUnknown.html > ... > irb(main):013:0> a.title > NoMethodError: undefined method `title' for # > from (irb):13 Since "a" is a DRbUnknown object, it doesn't have a title method; hence the exception. You need drb to send over a proxy for the object so you can send methods back to it. That's what DRb::DRbUndumped does. After you make that change, "a" will be a DRb::DRbObject, and the method calls will be sent back to the server. Or something like that...