gauge/app/models/talk.rb

16 lines
462 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'
2024-09-13 22:00:19 +03:00
self.site = ENV['GAUGE_TALKS_ENDPOINT'] || 'https://cfp.openfest.org/api/conferences/1'
2024-09-13 19:13:40 +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