Skip to content

Instantly share code, notes, and snippets.

@medhiwidjaja
Created January 31, 2014 01:26
Show Gist options
  • Save medhiwidjaja/8724964 to your computer and use it in GitHub Desktop.
Save medhiwidjaja/8724964 to your computer and use it in GitHub Desktop.
AnalysisMethods::Magiq::RankComparable module. Used be Magiq module. The OrdinalComparison object is embedded in the MongoDB document of the object that uses the Magiq module.
# Copyright (c) 2012 Medhi Widjaja
module AnalysisMethods
module Magiq
module RankComparable
class OrdinalComparison
include Mongoid::Document
field :id1, type: Moped::BSON::ObjectId
field :title, type: String
field :pos, type: Integer
field :rank, type: Integer
field :score, type: Float
embedded_in :ordinal_comparable
validates_uniqueness_of :id1
validates_presence_of :rank, :pos, :title, :id1
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment