public
Description: A Django-style filter-chaining extension for ActiveRecord::Base
Homepage: http://x451.com
Clone URL: git://github.com/flipsta/queryset.git
Search Repo:
name age message
folder CHANGELOG Sun Apr 27 16:33:02 -0700 2008 Imported from SVN [Flip Sasser]
folder LICENSE Sun Apr 27 16:33:02 -0700 2008 Imported from SVN [Flip Sasser]
folder README Sun Apr 27 16:33:02 -0700 2008 Imported from SVN [Flip Sasser]
folder Rakefile Sun Apr 27 16:33:02 -0700 2008 Imported from SVN [Flip Sasser]
folder init.rb Sun Apr 27 16:33:02 -0700 2008 Imported from SVN [Flip Sasser]
folder lib/ Sun Apr 27 16:38:33 -0700 2008 Removing .DS_Store... git import from SVN isn't... [Flip Sasser]
folder tasks/ Sun Apr 27 16:37:29 -0700 2008 Removing .svn... oops again [Flip Sasser]
folder test/ Sun Apr 27 16:35:53 -0700 2008 Removing .svn... oops [Flip Sasser]
README
= QuerySet

QuerySet provides three public class methods to ActiveRecord::Base to extend its searching functionality.

ActiveRecord::Base#dates accepts a column name and grouping type, and returns a collection of unique Date objects for 
which the model matches.

ActiveRecord::Base#filter, when provided with a keyword-argument list, returns a QuerySet class capable of extending 
ActiveRecord searches across model relationships in all directions, seamless OR and AND integration, LEFT JOINS for 
checking for non-empty relationships, and more.

ActiveRecord::Base#match accepts a column name and a string (against) which allows developers to integrate FULLTEXT 
searches quickly and easily.

For all examples below, we'll be working with the following models:

  class BlogPost < ActiveRecord::Base
    belongs_to :user
  end

  class User < ActiveRecord::Base
    has_many :blog_posts
  end

== DateSet and fetching groups of dates

DateSet is a simple extension which will perform a search on an ActiveRecord::Base subclass and return an array of dates 
for which such an object appears. To return a list of Date objects to, for example, list the months of your blog's 
archive, you could simply do this:

  dates = BlogPost.dates(:created_at,:month) # => [#<Date 1/10/2007>,#<Date 1/11/2007>,#<Date 1/12/2007>,#<Date 
  1/2/2008>,#<Date 1/4/2008>] 
  # (you were on vacation in January and March)

To filter your results closer, supply