Categoryz3Forms

<img src=“https://secure.travis-ci.org/tscolari/categoryz3_forms.png” alt=“Build Status” /> <img src=“https://codeclimate.com/badge.png” />

Adds a form helper (categories_select) for using with Categoryz3.

This helper is a select box, using the Select2 javascript, to select one or multiple categories, using autocomplete.

Instalation

gem 'categoryz3_forms'

Usage

form_for @model do |f|
  f.categories_select

  f.submit
end

In the categorizable model, you should make ‘categories_list` attr_accessible:

class SomeCategorizableModel < ActiveRecord::Base
  include Categoryz3::Categorizable
  attr_accessible :categories_list
end

Options

* unique: Only 1 category per model (Default false)
* max_categories: Max number of categories per model (Default nil)
* html_options: HTML options to be passed to the select field

Example:

f.categories_select(unique: false, max_categories: 2, html_options: {id: 'special_field'})

License

MIT License. Copyright 2012 Tiago Scolari.