No commit activity in last 3 years
No release in over 3 years
Allows any model to be categorized.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.10, ~> 1.10
>= 1.5.1, ~> 1.5.1
>= 4.2.5, ~> 4.2.5
>= 10.0, ~> 10.0
>= 3.4.0, ~> 3.4.0
>= 1.3.11, ~> 1.3.11

Runtime

>= 2.1.0, ~> 2.1.0
>= 5.1.0, ~> 5.1.0
 Project Readme

ActsAsCategorizable

This gem allows any model to be categorized.

Categories can be defined in a tree structure, allowing items to be structured. They also support slugs, so they can be used for Semantic URLs.

Usage (Rails 4+)

Add this line to your application's Gemfile:

gem 'acts_as_categorizable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install acts_as_categorizable

Installation

rails g acts-as-categorizable:migration <table_name> # default 'aac_categories'
rake db:migrate

Usage

class Page < ActiveRecord::Base
  acts_as_categorizable table_name: 'categories_table', # Default: 'aac_categories'
                        class_name: 'CustomCategory',   # Default: 'ActsAsCategorizable::Category'
                        dependent: :destroy             # Default: :nullify
end

TODO

There are still a lot of things to add to this gem. Consider it as a work in progress. Some of the missing stuff is:

  • Unit testing
  • Sortable categories
  • Better searching functionality

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/woopasoft/acts_as_categorizable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Special mentions

This gem is heavily inspired in ActsAsMessageable and ActsAsCommentable Thank you guys for publishing your work!

License

The gem is available as open source under the terms of the MIT License.