Article:
  Rolling with Ruby on Rails, Part 2
Subject:   find_all and categories
Date:   2006-09-20 14:20:24
From:   Lumpio-
I'm not really familiar with Rails, but isn't doing


@recipes = Recipe.find_all


and then limiting the results with an if while looping through ALL recipes very inefficient? Wouldn't using a WHERE clause be much better?


This is why I haven't really started using data objects - it's all easy and neat when you only need "CRUD" but I've yet to see one neat way of, for example, representing complex JOINs or any kind of functions calls in SQL when using data objects.

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • Curt Hibbs photo find_all and categories
    2006-09-20 14:25:34  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

    Yes, this is a very inefficient way of doing this. Rails does support using the WHERE clause, it just wasn't used in this tutorial.