gauge/app/models/talk.rb

16 lines
431 B
Ruby
Raw Normal View History

2015-10-06 15:21:46 +03:00
class Talk < ActiveResource::Base
2016-10-05 14:49:17 +03:00
has_many :selections, class_name: 'SelectedTalk'
2016-10-01 01:58:56 +03:00
self.site = "https://cfp.openfest.org/api/conferences/3"
2015-10-06 15:21:46 +03:00
self.element_name = "event"
2015-10-06 21:37:53 +03:00
2016-10-10 20:20:56 +03:00
def self.ordered_by_id
find(:all, from: :halfnarp_friendly).sort_by(&:id)
end
2015-10-06 21:37:53 +03:00
def self.ordered_by_rating
ratings = Ratings.new
2015-10-08 02:58:34 +03:00
find(:all, from: :halfnarp_friendly).sort { |left, right| ratings[right.id] <=> ratings[left.id] }
2015-10-06 21:37:53 +03:00
end
2015-10-06 15:21:46 +03:00
end