Sha256: 82f10b3a27c27531e4057daa5d6af80f45c449274505edc4b567a36925aaa08d

Contents?: true

Size: 511 Bytes

Versions: 10

Compression:

Stored size: 511 Bytes

Contents

module OrderedTree
  module ClassMethods
    extend ActiveSupport::Concern
    included do
      def foreign_key_column
        :"#{ordered_tree_config[:foreign_key]}"
      end

      def order_column
        :"#{ordered_tree_config[:order]}"
      end

      before_create :add_to_list
      before_update :check_list_changes
      after_update :reorder_old_list
      before_destroy :destroy_descendants
      after_destroy :reorder_old_list
      validate :check_parentage, :on => :update
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ordered_tree-1.0.0 lib/ordered_tree/class_methods.rb
ordered_tree-0.2.1 lib/ordered_tree/class_methods.rb
ordered_tree-0.1.9 lib/ordered_tree/class_methods.rb
ordered_tree-0.1.8 lib/ordered_tree/class_methods.rb
ordered_tree-0.1.7 lib/ordered_tree/class_methods.rb
ordered_tree-0.1.6 lib/ordered_tree/class_methods.rb
ordered_tree-0.1.5 lib/ordered_tree/class_methods.rb
ordered_tree-0.1.4 lib/ordered_tree/class_methods.rb
ordered_tree-0.1.3 lib/ordered_tree/class_methods.rb
ordered_tree-0.1.2 lib/ordered_tree/class_methods.rb