[Nitro] Og and 'duck typing' search

Arne Brasseur arne at arnebrasseur.net
Sat Jun 7 05:39:21 EDT 2008


You should be able to do something like

Og.managed_classes.map {|c| c.find_by_name(name)}.flatten

A.

George Moschovitis wrote:
> No you should do it for all classes:
>
> User.find_by_name(name)
> Post.find_by_name(name)
>
> etc...
>
> -g.
>
> On Fri, Jun 6, 2008 at 2:28 AM, Alexey Petrushin <lists at ruby-forum.com 
> <mailto:lists at ruby-forum.com>> wrote:
>
>     Can Og search for 'name' in all 'managed' classes?
>
>     I.e. there are: Post, User, Topic, Comment, ..., and all of them have
>     the 'name' property. So, can i use something like:
>
>            Og.search_by_name('my_name')?
>
>     Or i should explicitly do it for all classes? I.e.:
>
>            Post.search_by_name('my_name').
>            concat(User.search_by_name('my_name')).
>            concat ...
>     --
>     Posted via http://www.ruby-forum.com/.
>     _______________________________________________
>     Nitro-general mailing list
>     Nitro-general at rubyforge.org <mailto:Nitro-general at rubyforge.org>
>     http://rubyforge.org/mailman/listinfo/nitro-general
>
>
>
>
> -- 
> http://gmosx.me.gr
> http://joy.gr
> http://cull.gr
> http://nitroproject.org
> http://phidz.com
> http://joyerz.com
> ------------------------------------------------------------------------
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general


-- 
Ein Fuchs muß tun, was ein Fuchs tun muß
arne at arnebrasseur.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/nitro-general/attachments/20080607/833bd56c/attachment-0001.html>


More information about the Nitro-general mailing list