On Aug 25, 2006, at 1:32 PM, Philippe Lang wrote:

> Ezra Zygmuntowicz wrote:
>
>>> Hi,
>>>
>>> Thanks for your answer. I see now where the problem comes from, but
>>> your "trick" is apparently not sufficient. The code...
>>>
>>> class Garden < ActiveRecord::Base
>>>   include DRbUndumped
>>>   has_many :flowers
>>>   alias :id__ :id
>>> end
>>>
>>> class Flower < ActiveRecord::Base
>>>   include DRbUndumped
>>>   belongs_to :garden
>>>   alias :id__ :id
>>> End
>>>
>>> ... Still does not work...
>>
>>
>> Hey Philip-
>>
>> 	I have dealt alot with ActiveRecord over drb, I use it
>> in this plugin for rails[1] . The way around this is to use a
>> different notation to get the id of the AR object.  So with
>> your client example change it to this and you will be fine:
>>
>> #!/usr/local/bin/ruby
>> require 'drb'
>>
>> DRb.start_service()
>> obj = DRbObject.new(nil, 'druby://localhost:9000')
>>
>> g = obj.find(1)
>> puts "#{g[:id]} | #{g.name}"
>> g.flowers.each do |f|
>>    puts "#{f[:if]} | #{f[:id]} | #{f.name}"
>> end
>>
>> 	So by using arinstance[:id] instead of arinstance.id
>> you will avoid this problem all together.
>
> Hey thanks a lot Erza, it works great!
>
> I have one more question if you don't mind... Now that I can get  
> ActiveRecords through Drb, I intend to use them in order to  
> populate FOX widgets on a fat client, and send the changes back to  
> the server when the user decides to apply the changes.
>
> Do you think performances will be OK for a relatively complex GUI,  
> through a low-bandwith network? Does a DrbUndumped ActiveRecord  
> object generate a lot of round-trips when reading and writing the  
> data in the object?


Hey Philip-

	My first guess would be that it should be fine. But without knowing  
more details it is hard to say for sure. I think the best thing you  
could do is run some simulations and benchmark it to see if it is  
acceptable to you. Run it over the same slow networks you would be in  
the real version and just use irb on the client side to crete and  
edit a bunch of AR objects over drb and monitor the network traffic  
with netstat or something and benchmark with the built in benchmark  
class. This should give yopu a good idea about what you can expect  
performance wise.

Cheers-
-Ezra