[Seaside] Equiv. ruby's method_missing

Humber Aquino humberaquino at gmail.com
Wed Aug 23 15:41:24 UTC 2006


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 <bakki.kudva at gmail.com> wrote:
>
> 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
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20060823/10a6ab66/attachment.htm


More information about the Seaside mailing list