There are a few ways to do this. One would be using a named_scope in Rails 2 or just plain scope in Rails 3
class Bookings < ActiveRecord::Base named_scope :discount, :conditions => { :discount > .5 } I like to model class methods for pulling specific information from the database def self.inactive find( :all, :conditions => ["inactive = ?", 1], :order => :last_calibrated_on ) end And then in the controller: @inactive = Item,inactive In Rails 3 there is a new query interface ( http://m.onkey.org/2010/1/22/active-record-query-interface ) The neat thing here is that it seems to map well to what you're doing. You start off creating a relation that you can then manipulate, but the query doesn't fire until you want it too. Getting those datasets or updating the limits could be done through javascript on the view page, periodically_call_remote or an observer on a field. On Jul 11, 2:34 am, Mark Horrocks <li...@ruby-forum.com> wrote: > I am currently converting a large Delphi webbroker application to RoR. > The Delphi application makes extensive use of client datasets and > setrange which can limit the range of records returned to a client > dataset in an SQL call without the overhead of making another SQL call. > The setrange call can be issued in a loop to repeatedly change the range > of records viewable in the dataset. > > My app frequently issues the setrange command to a dataset in a loop in > order to test for previous game time bookings in a sports application. > Is there any way I can do this in Rails or do I need to repeatedly make > SQL queries to return the data subset? > -- > Posted viahttp://www.ruby-forum.com/. -- 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.