Tom Pollard
1/29/2007 7:04:00 PM
On Jan 29, 2007, at 1:50 PM, Tim Hunter wrote:
> Tom Pollard wrote:
>> On Jan 29, 2007, at 12:28 PM, Alex Amat wrote:
>>> I have a web service with a method called {}id however when i
>>> call this
>>> method project.id it returns the Object id instead of calling the
>>> method
>>> id.
>>>
>>> Any ideas on how to call the method id
>> I've run into the same problem. My conclusion is that 'id' is
>> effectively a reserved method name in Ruby, and you simply need to
>> avoid creating your own 'id' method. I just don't see how a
>> custom 'id' method could possibly avoid interfering with Object#id.
>> Tom
>
> Use __id__ instead of just id.
My concern was that other parts of the Ruby infrastructure would
depend on the 'id' method to be Object#id. Is Object#id really just
an alias for Object#__id__ , and so it's safe to redefine it?
Thanks,
Tom