🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

mongo_mapper_tree

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongo_mapper_tree

1.1.2
Rubygems
Version published
Maintainers
2
Created
Source

= mongo_mapper_tree

This is an maintained version of mongo_mapper_acts_as_tree (https://github.com/ramdiv/mongo_mapper_acts_as_tree) (ie. most of the code is written by Jacob Vidmar) In it's essence it's an implementation of a tree structure for MongoMapper, think acts as tree but for mongodb.

== Installation

Install as gem

gem install mongo_mapper_tree

== Usage

Enable the tree functionality by declaring acts_as_tree on your model

class Category include MongoMapper::Document plugin MongoMapper::Plugins::Tree

key :name, String

end

This adds class_attributes called parent_id_field, path_field, depth_field, tree_order and tree_search_class.

parent_id_field, path_field and depth_field overrides the default field names tree_order controls the order (format :field_name.[asc|desc]) tree_search_class expects a Class that is a MongoMapper::Document to be used for search

Check test_tree.rb and test_search_class.rb for examples.

For best performance add a index on the field called path_field.

== Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

== Copyright

Original code written by Jakob Vidmar https://github.com/ramdiv/mongo_mapper_acts_as_tree Copyright (c) 2011 Joel Junström. See LICENSE for details.

FAQs

Package last updated on 09 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts