Skip to content

Instantly share code, notes, and snippets.

@seivan
Created March 20, 2009 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save seivan/82438 to your computer and use it in GitHub Desktop.
Save seivan/82438 to your computer and use it in GitHub Desktop.
class Person < ActiveRecord::Base
def self.find_recent
people = find(
:conditions => ["added_at > ? and deleted = ?", Time.now.utc, false],
:order => "last_name, first_name")
people.reject { |p| p.address.nil? }
end
# ...
end
# app/controllers/people_controller.rb
class PeopleController < ActionController::Base
def index
@people = Person.find_recent
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment