Og and 'duck typing' search


#1

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 ...

#2

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 P. removed_email_address@domain.invalid


#3

You should be able to do something like

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

A.