Module: RankedModel

Defined in:
lib/ranked-model.rb,
lib/ranked-model/ranker.rb,
lib/ranked-model/railtie.rb,
lib/ranked-model/version.rb

Defined Under Namespace

Modules: ClassMethods Classes: InvalidField, InvalidScope, NonNilColumnDefault, Railtie, Ranker

Constant Summary collapse

MAX_RANK_VALUE =

Signed INT in MySQL

2147483647
MIN_RANK_VALUE =
-2147483648
VERSION =
"0.4.11"

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ranked-model.rb', line 13

def self.included base

  base.class_eval do
    class_attribute :rankers

    extend RankedModel::ClassMethods

    before_save :handle_ranking

    scope :rank, lambda { |name|
      reorder ranker(name.to_sym).column
    }
  end

end