Skip to content

Instantly share code, notes, and snippets.

@adamgamble
Created November 6, 2010 06:09
Show Gist options
  • Save adamgamble/665229 to your computer and use it in GitHub Desktop.
Save adamgamble/665229 to your computer and use it in GitHub Desktop.
class Person < ActiveRecord::Base
named_scope hair_color, lambda { |hair_color| { :conditions => ["people.hair_color = ?", hair_color]}}
named_scope enjoys_chunky_bacon, lambda { |chunky_bacon_preference| {:conditions => ["people.chunky_bacon_preference = ?", chunky_bacon_prefence]}}
named_scope age_between, lambda { |lower_limit, upper_limit| {:conditions => ["people.age BETWEEN ? AND ?", lower_limit, upper_limit]}}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment