Module: Redmine::Acts::Positioned::ClassMethods

Defined in:
lib/redmine/acts/positioned.rb

Overview

This extension provides the capabilities for reordering objects in a list. The class needs to have a position column defined as an integer on the mapped database table.

Instance Method Summary collapse

Instance Method Details

#acts_as_positioned(options = {}) ⇒ Object

Configuration options are:

  • scope - restricts what is to be considered a list. Must be a symbol

or an array of symbols

Since:

  • 3.3.0



33
34
35
36
37
38
39
40
41
42
# File 'lib/redmine/acts/positioned.rb', line 33

def acts_as_positioned(options = {})
  class_attribute :positioned_options
  self.positioned_options = {:scope => Array(options[:scope])}

  send :include, Redmine::Acts::Positioned::InstanceMethods

  before_save :set_default_position
  after_save :update_position
  after_destroy :remove_position
end