[Nitro] Complex selections

George Moschovitis george.moschovitis at gmail.com
Wed Mar 23 03:33:10 EST 2005


> I have an app (well, I'm learning Nitro/Og as I write it) that has a
> fairly simple object model.
> ...
> I want to be able to select a set of resources that have one or more
> tags with a given name.

Hmm I am planning to use Nitro for something like this :)

> Probably not the most efficient way to do this, and almost certainly not
> correct Og-speak.
> ...
> In my first go-round with Rails (where I first implemented this), I did
> not find any nice Ruby-based way to do this, and ended up falling back
> on assorted SQL (and running into various issues with subselect and MySQL).

Can you suggest an API for this? I dont have something available, but
I would like to add this functionality. Can you post the SQL query you
would actually use and then we can extract some kind of API.

Btw this is similar to another feature I want to add: join queries.

Let me demonstrate with an example.

class User
  property :name, String
  has_many :comments, Comment
end

class Comment

  belongs_to :user, User
end

u = User['george']

u.comments(:join => User)


> 
> Is there some way to do this in Og without also having to hand-craft the
> SQL?  Is this sort of select just better done using in SQL?
> 
> Thanks,
> 
> James
> 
> --
> 
> http://www.ruby-doc.org
> http://www.rubyxml.com
> http://catapult.rubyforge.com
> http://orbjson.rubyforge.com
> http://ooo4r.rubyforge.com
> http://www.jamesbritt.com
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
> 


-- 
http://nitro.rubyforge.org
http://www.joy.gr



More information about the Nitro-general mailing list