In Microsoft's LINQ after you define your model, you can say something
like this:

   var products = from p in products where p.category.name == "Books"
select p;

This gets translated in the following SQL statement (roughly)

   SELECT * FROM products LEFT OUTER JOIN categories ON categories.id
= products.category_id where categories.name = "Books"

Since we already have the model mostly defined through has_many/
has_one/belongs_to/etc. declarations, wouldn't it be nice if we could
say:

   products = Product.find(:all, :conditions => ['category.name = ?',
"Books"])

which would then generate the left outer join query.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to