Sha256: 4ed1da02b348fa217004749940da308159094d92c843dfa951a826eb28bf6828

Contents?: true

Size: 644 Bytes

Versions: 9

Compression:

Stored size: 644 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 3 or Rails 4"
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
the_sortable_tree-2.5.0 lib/the_sortable_tree.rb
the_sortable_tree-2.4.0 lib/the_sortable_tree.rb
the_sortable_tree-2.3.3 lib/the_sortable_tree.rb
the_sortable_tree-2.3.2 lib/the_sortable_tree.rb
the_sortable_tree-2.3.1 lib/the_sortable_tree.rb
the_sortable_tree-2.3.0 lib/the_sortable_tree.rb
the_sortable_tree-2.2.1 lib/the_sortable_tree.rb
the_sortable_tree-2.2.0 lib/the_sortable_tree.rb
the_sortable_tree-2.1.0 lib/the_sortable_tree.rb