Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 6c488e56a4
Fetching contributors…

Cannot retrieve contributors at this time

27 lines (20 sloc) 0.472 kb
class School < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
has_many :registrations
def self.names
alphabetical.map(&:name)
end
def self.alphabetical
order('name asc')
end
def self.most_students
order('registrations_count desc')
end
def self.stats
order('registrations_count desc').to_csv(:only => [:name, :registrations_count])
end
def students
registrations.order("name asc")
end
end
Jump to Line
Something went wrong with that request. Please try again.