From: Avi Bryant Date: 2001-11-06T07:02:40+09:00 Subject: [ruby-talk:24431] Re: Detect future method calls in method_mi ssing? On Tue, 6 Nov 2001, Morris, Chris wrote: > This: > > form.anElement = blergh #equiv to form.send(:anElement=, blergh) > > wouldn't work. Again, let me be more precise (sorry if I'm confusing): > > form.anElement = 'blergh' > > If this is simply forwarded through [form.send(:anElement=, 'blergh')], it's > invalid because anElement is an object, not a string. In my method_missing, > I turn anElement= into anElement.value= Right. But that shouldn't affect calls to anElement at all. So whatever funny business you do with anElement=, calls like form.anElement.fooBar should work just fine (assuming you pass the call to anElement through your wrapper unchanged). > Here's how I resolved it, works for now: > > form.aTextElement = 'blergh' > form.aCheckboxElement = true > > ... I simply do a lookup of the node's type and substitute .value for text > nodes and .checked for checkbox nodes. Works better than my original desired > solution. I would suggest introducing a method like default_value that you actually call on any node, and override it to be value/checked/whatever for each node type...