From: "Morris, Chris" Date: 2001-11-06T06:46:38+09:00 Subject: [ruby-talk:24430] Re: Detect future method calls in method_mi ssing? > But this is actually a call to anElement=, right? It seems > like you could > reroute anElement= without touching calls to anElement... > > That is, you have > > form.anElement = blergh #equiv to form.send(:anElement=, blergh) > form.anElement.checked = true #equiv to form.anElement.send(:checked=, true) > > and I don't see why those would ever get confused with each other. 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= 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. My only concern is the day the script writer needs to get at something else other than my force-fed default property (.value/.checked). I'm fooling them right now, which is clever, but might be more confusing than cool in the end. Ah well, it's just my boss :) Chris