Skip to content

Instantly share code, notes, and snippets.

@bnadlerjr
Created November 19, 2009 20:24
Show Gist options
  • Save bnadlerjr/239022 to your computer and use it in GitHub Desktop.
Save bnadlerjr/239022 to your computer and use it in GitHub Desktop.
named_scope :active, :conditions => {:active => true}
def self.random
self.active.find(:first, :order => ‘RAND()’)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment