No commit activity in last 3 years
No release in over 3 years
Create virtual mutable columns on activerecord models.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme
ActsAsItemized
==============

This acts_as extension provides the ability to create virtual mutable columns on activerecord models. The items are stored in itemized_items. 

Demo rails application: https://github.com/blakehilscher/acts_as_itemized-rails


Migration
======

def change

  create_table :itemized_items do |t|
    t.integer :itemizable_id
    t.string  :itemizable_type
    t.string  :item_type
    t.integer :position
    t.boolean :checked
    t.string  :content
    t.integer :score
    t.timestamps
  end

end


Example
=======
  
  
  class ItemizedItem < ActiveRecord::Base
    belongs_to :itemizable, :polymorphic => true
  end
  
  class Form < ActiveRecord::Base
    acts_as_itemized

    after_initialize :initialize_items

    def initialize_items
      itemize :first_name, :last_name
      itemize :instruments => {:count => 5, :columns => [:content, :checked] }
    end

  end
  
  f = Form.new
  
  f.first_name = 'blake'
  f.last_name = 'haven'
  f.instrument_content_1 = 'Trumpet'
  f.instrument_checked_1 = true
  f.instrument_content_2 = 'Violin'
  f.instrument_checked_2 = false
  
  f.save