[email protected] wrote:
certain methods are treated specially by drb. it was a
mistake for rails to override Object#id for exatly this kind
of scenario - many peice of code require it.
you need to do something like
class << ActiveRecord
alias “id__”, “id”
end
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…
On Aug 25, 2006, at 9:23 AM, Philippe L. wrote:
Object#object_id 67880122 | 1 | flower2
end
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.
Cheers-
-Ezra
[1] http://backgroundrb.rubyforge.org