Sha256: 0d243156f594f0ba3fe74a6b1d1b7f142a0bf73c2b12fb98942cc51cec7f5968

Contents?: true

Size: 645 Bytes

Versions: 4

Compression:

Stored size: 645 Bytes

Contents

require "the_sortable_tree/engine"
require "the_sortable_tree/version"

# include TheSortableTree::Scopes
module TheSortableTree
  module Scopes
    def self.included(base)
      base.class_eval do
        if Rails::VERSION::MAJOR == 3
          scope :nested_set,          order('lft ASC')
          scope :reversed_nested_set, order('lft DESC')
        elsif Rails::VERSION::MAJOR >= 4
          scope :nested_set,          lambda { order('lft ASC')  }
          scope :reversed_nested_set, lambda { order('lft DESC') }
        else
          puts "[TheSortableTree] ERROR: required Rails >= version 3"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
the_sortable_tree-2.6.2 lib/the_sortable_tree.rb
the_sortable_tree-2.7.0 lib/the_sortable_tree.rb
the_sortable_tree-2.6.1 lib/the_sortable_tree.rb
the_sortable_tree-2.6.0 lib/the_sortable_tree.rb