Skip to content

Instantly share code, notes, and snippets.

@loe
Created February 24, 2009 06:12
Show Gist options
  • Save loe/69444 to your computer and use it in GitHub Desktop.
Save loe/69444 to your computer and use it in GitHub Desktop.
class Group < ActiveRecord::Base
belongs_to :location
validates_presence_of :name, :location_id
def self.sort(page, order)
options = {}
if order == 'location'
options[:order] = 'location_id'
else order == 'name'
options[:order] = name
end
paginate {:page => page, :per_page => 10}.merge!(options)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment