Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

archive_tree

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

archive_tree

  • 1.0.3
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Introduction

ArchiveTree is a Ruby Gem for your Ruby on Rails application that makes it easy for you to generate structured trees of your records.

Since it uses a column of your choice, from any ActiveRecord Model, you will have flexibility to use in most of the Ruby on Rails applications

Compatibility

The Gem was developed to work with Rails 3.0.x, running on Ruby 1.8.7 or 1.9.2. Since it uses SQL specific queries, it works on MySQL and PostgreSQL databases.

Note: This gem does not work with Ruby v1.9.1.

Installation

You can install ArchiveTree can be installed as a Ruby gem. This is specially made easy with Bundler. Just add this to your Gemfile

gem 'archive_tree'

It's also possible to install ArchiveTree as a Rails plugin

rails plugin install git://github.com/GnomesLab/archive_tree.git

Demo (live)

If you would like to see this gem in action please visit Gnomeslab blog at http://gnomeslab.com/blog.

Examples

Imagine that you have a blog application with Posts. Great!

Now let's say that you wish to allow your users to sweep through your posts in a chronologically accurate tree view. Enters ArchiveTree!

API

Inclusion:

In your ActiveRecord Model:

acts_as_archive #=> defaults to :created_at
Default usage:
Post.archive_tree #=> { 2010 => { 1 => [Post], 2 => [Post] },
                        2011 => { 1 => [Post], 4 => [Post], 8 => [Post] } }
Sweep all months of the current year:
Post.archive_tree(:years => [Time.now.year]) #=> { 2010 => { 1 => [Post], 2 => [Post] } }
Skip all months other than January (1):
Post.archive_tree(:months => [1]) #=> { 2010 => { 1 => [Post] },
                                      { 2011 => { 1 => [Post] } } }
Only sweep January 2010:
Post.archive_tree(:years_and_months => { 2010 => [1] }) #=> { 2010 => { 1 => [Post] } }

View

draw_archive_tree #=> defaults to: :model_sym => :post, :route => :posts_path, :toggle => true, :toggle_text => '[ + ]'

Documentation

This gem's documentation documentation is available at rubydoc.info

License

Copyright (c) 2010 Diogo Almeida, released under the MIT license. For more information regarding MIT license, please check our MIT license file

Feedback, issues and contributions

If you have an issue with ArchiveTree please create a ticket in our issue tracker.

Feel free to fork this project at any time and submit your changes (along with their respective tests).

Should you just wish to provide feedback or say hi, you can always contact us directly through diogo (dot) almeida (at) gnomeslab (dot) com

FAQs

Package last updated on 17 Nov 2010

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc