[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: ActiveRecord through Drb: problem with ids

Ara.T.Howard

8/25/2006 2:38:00 PM

2 Answers

Julian 'Julik' Tarkhanov

8/27/2006 3:07:00 PM

0


On 25-aug-2006, at 16:38, ara.t.howard@noaa.gov 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.

Consdering that Object#id is marked deprecated - I think it was a
good decision. I'd rather say it's a problem with DrB that it doesn't
use object_id instead
--
Julian 'Julik' Tarkhanov
please send all personal mail to
me at julik.nl



Vincent Alsteen

9/4/2006 9:59:00 PM

0

hi,

I just found this thread because I had a similar problem. I don't think
it has something to do with drb, in fact my problem was that a "find" on
an activerecord returned a nil object. Here is the gotcha : nil is still
an object and has an id ... which has nothing to do with database id's.
As ruby's author knows it's an usual pitfall, calling that method
produces a warning.

I think the alias workaround is great, here is the syntax I used :

class ActiveRecord::Base
alias_method :id__, :id
end

This way you can use the method id__ for any ActiveRecord::Base
descendant. Useful to spot some bugs !

--
Posted via http://www.ruby-....