This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.autotest | Tue Jan 27 01:51:00 -0800 2009 | |
| |
.gitignore | Tue Jan 27 01:51:00 -0800 2009 | |
| |
CHANGELOG | Tue Jan 27 10:30:59 -0800 2009 | |
| |
LICENSE | Tue Jan 27 01:56:34 -0800 2009 | |
| |
README.rdoc | Tue Jan 27 10:30:59 -0800 2009 | |
| |
Rakefile | Tue Jan 27 10:30:59 -0800 2009 | |
| |
init.rb | Tue Jan 27 00:29:20 -0800 2009 | |
| |
lib/ | Tue Jan 27 10:30:59 -0800 2009 | |
| |
quick_scopes.gemspec | Tue Jan 27 10:30:59 -0800 2009 | |
| |
test/ | Tue Jan 27 10:30:59 -0800 2009 |
README.rdoc
A Rails plugin to automatically add some quick named_scopes to your models.
These are especially useful for quick modifications to a query on an association.
The named_scopes
The named scopes added are:
- order
- limit
- offset
- with - alias for :include
- where - alias for :conditions
Examples
With a User model having many Posts
# Standard association method to retrieve all posts
user.posts
# Order the posts
user.posts.order('created_at')
# Limit the results to a specific number
user.posts.limit(5)
# Offset the results
user.posts.offset(5)
# Include other associated models
user.posts.with(:comments)
user.posts.with(:comments, :author)
user.posts.with({:comments => :author}, :author)
# Limit your results with conditions
user.posts.where(:published => true)
Note
Some of these don’t promote best practices for your code but can be very useful when working with the console.







