Skip to content

Instantly share code, notes, and snippets.

@rsl
Forked from seivan/snippet.txt
Created March 20, 2009 16:56
Show Gist options
  • Save rsl/82441 to your computer and use it in GitHub Desktop.
Save rsl/82441 to your computer and use it in GitHub Desktop.
class Person < ActiveRecord::Base
def self.find_recent
people = find(
:conditions => ["added_at > ? and deleted = ? and address is not null", Time.now.utc, false],
:order => "last_name, first_name")
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