Module: Rankle::InstanceMethods

Defined in:
lib/rankle.rb

Overview

instance methods added to ActiveRecord models

Instance Method Summary collapse

Instance Method Details

#position(name = :default) ⇒ Object



53
54
55
# File 'lib/rankle.rb', line 53

def position name = :default
  RankleIndex.position self, name
end

#position=(position) ⇒ Integer or Exception

Assigns an explicit position to the record using the default ranker

Parameters:

  • format (Integer)

    the new position

Returns:

  • (Integer or Exception)

    the new position or an exception if the position could not be set



45
46
47
# File 'lib/rankle.rb', line 45

def position= position
  rank position
end

#rank(name = :default, position) ⇒ Object



49
50
51
# File 'lib/rankle.rb', line 49

def rank name = :default, position
  RankleIndex.rank self, name, position
end

#set_default_positionObject



37
38
39
# File 'lib/rankle.rb', line 37

def set_default_position
  RankleIndex.set_default_position self
end