Hi all,
Rail's Activerecord uses Ruby's method_missing to implement dynamic finders such as find_by_#column_name() which is done by defining in the receiver... def method_missing(method_id, *arguments) if match = /find_(all_by|by)_([_a-zA-Z]\w*)/.match(method_id.to_s) finder, deprecated_finder = determine_finder(match), determine_deprecated_finder(match) attribute_names = extract_attribute_names_from_match(match) super unless all_attributes_exists?(attribute_names) <snip> Does Smalltalk have some way of emulating this? I am reading Smalltalk-80 books and don't see anything there. Is the current language support such callback hooks (and others which trap object create events and such?) I was inspired to study this when I read an old thread (2005) on the seaside list about writing an activerecord like layer for Seaside...although GLORP may be a better option in the long run. This is pretty much an academic excercise for me now. THanks for your help, bakki _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
The "equivalent" method is
doesNotUnderstand: aMessage "Handle the fact that there was an attempt to send the given message to the receiver but the receiver does not understand this message (typically sent from the machine when a message is sent to the receiver and no method is defined for that selector)." "Testing: (3 activeProcess)" Is defined in the Object Class. On 8/23/06, Bakki Kudva <[hidden email]> wrote: Hi all, _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Bakki Kudva
> Does Smalltalk have some way of emulating this?
> > bakki doesNotUnderstand, and btw, Smalltalk doesn't need to "emulate" this, Ruby copied this feature from Smalltalk. _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Humber Aquino
Ah! I was looking for the wrong msg. THanks for pointing this out. Now
I see it.,,and Ramon, I sort of had a gut feel that Ruby got it from Smalltalk but didn't realize it was renamed to method_missing. Had I dug deep enought I would have found it especially since I'd seen it when doing Seaside coding. Sorry about posting a bit too hastily. -bakki On 8/23/06, Humber Aquino <[hidden email]> wrote: > The "equivalent" method is > > doesNotUnderstand: aMessage > "Handle the fact that there was an attempt to send the given message to > the receiver but the receiver does not understand this message (typically > sent from the machine when a message is sent to the receiver and no method > is defined for that selector)." > "Testing: (3 activeProcess)" > > Is defined in the Object Class. > Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> Ah! I was looking for the wrong msg. THanks for pointing this
> out. Now I see it.,,and Ramon, I sort of had a gut feel that > Ruby got it from Smalltalk but didn't realize it was renamed > to method_missing. Had I dug deep enought I would have found > it especially since I'd seen it when doing Seaside coding. > Sorry about posting a bit too hastily. > > -bakki Don't be sorry, there are no stupid questions, I was just messing with you a bit. _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |