> > And then in the controller: > > > @inactive = Item.inactive > > This looks like it will still fire off a query which is what I want to > avoid.
The query would only fire (once) prior to rendering the view. For example, if you set the variable in the index action of the controller the query would only be run after calling the index action. > cars = Car.scoped > rich_ppls_cars = cars.order('cars.price DESC').limit(10) > > It appears that the call to cars fires the query but the call to > rich_ppls_cars only works on the resultant dataset and does not fire a > new query. Would that be correct? For example, I could then say > poor_ppls_cars = cars.order('cars.price ASC').limit(10) and I would get > different data without a new query? In Rails 3 the cars example above, you are creating a relation. The query is fired when you call rich_people_cars.first or .all Looking at some of the other posts here I agree there could be some misunderstanding of what you're trying to do. If it's 16 teams * 16 games that's only 256 results. You can query all the records and then logically view the remainder in instance variables. Also, if you're looking at the bookings for holes then perhaps you set the query to return records based on the date and venue. There are only so many dates and venues available after all. Interesting problem though and a good way to learn Rails. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.