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 (
sconnect /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Fri Feb 20 19:10:27 -0800 2009 | |
| |
README.rdoc | Fri Feb 20 20:59:03 -0800 2009 | |
| |
Rakefile | Fri Feb 20 21:06:04 -0800 2009 | |
| |
lib/ | Fri Feb 20 20:59:03 -0800 2009 | |
| |
sconnect.gemspec | Fri Feb 20 21:06:04 -0800 2009 | |
| |
spec/ | Fri Feb 20 20:41:06 -0800 2009 |
README.rdoc
Sconnect
Sconnect is an extension to ActiveRecord’s named_scopes that allows you to combine scopes in more interesting and useful ways.
Download
Github: github.com/jferris/sconnect/tree/master
Examples
Given the following model:
class Post < ActiveRecord::Base
named_scope :published, :conditions => { :published => true }
named_scope :titled, :conditions => "title IS NOT NULL"
named_scope :from_today, lambda {
{ :conditions => ['created_at >= ?', 1.day.ago] }
}
end
ActiveRecord provides scope chains:
# All published posts with titles Post.published.titled # All published posts from today Post.published.from_today
Sconnect extends these scopes:
# All posts that are either published or titled Post.published.or.titled # All posts that are published but not created today Post.published.not.from_today # All posts that are either published or untitled Post.published.or.not.titled # All posts from today that are either published or titled Post.published.or.titled.from_today
Author
Sconnect was written by Joe Ferris.







