Daniel Schierbeck
7/28/2006 9:13:00 PM
ara.t.howard@noaa.gov wrote:
> On Sat, 29 Jul 2006, Daniel Schierbeck wrote:
>
>> Andrew Knott wrote:
>>> Ok, that's worked perfectly for the call... Unfortunately on the
>>> server side I have a member of the same name in an Action Webservice
>>> Struct and it's not liking the
>>>
>>> member :"remote-ip", :string
>>>
>>> at all...
>>>
>>> SyntaxError ((eval):1:in `member': compile error
>>> (eval):1: parse error, unexpected '-', expecting '\n' or ';'
>>> def remote-ip; @remote-ip; end
>>>
>>> I guess this might be bug in rails...
>>
>> No; "remote-ip" is here the name of a method and an instance variable,
>> but neither can contain `-'.
>
> but i think rails is autogenerating this method - it's a major design
> flaw if
> so.
Yeah, I guess it would be smarter to replace the hyphen with an underscore.
Andrew, note that methods can actually have such names, they just can't
be called or defined the normal way;
class Foo
define_method("foo-bar"){"FUBAR!!!!1!one"}
end
Foo.new.send("foo-bar") #=> "FUBAR!!!!1!one"
Cheers,
Daniel