Sha256: e66e811fbfe3deba22b244cf65bd9fcfcb76ed7b3d0d65817f1a08efad91e3ac
Contents?: true
Size: 1.46 KB
Versions: 5
Compression:
Stored size: 1.46 KB
Contents
= Archive 2s This gem provides the ability to archive a meaningful bit of information. This is good for use with friendly_id or stats. It will save to a single table that is created via a migration copied from the rake task == Usage archive_2s accepts two optional parameters, :method_name and :include_by_default class Item < ActiveRecord::Base archive_2s :method_name => :name, :include_by_default => true def name [self.first_name, self.middle_initial, self.last_name].join(' ') end end :method_name is the methods return value you wish to save and :include_by_default will include archived results when you fetch by id only (as all that is saved is the id and a value of a method) All objects returned are readonly. == Migration See the last todo, this needs to me a generator/rake task but I am tired and want to goto sleep create_table :archived_to_s do |t| t.datetime :archived_at t.string :model_type t.integer :model_id t.string :archived_value end add_index :archived_to_s, [:model_type,:model_id,:archived_at], :name => 'model_and_archive_date_idx', :unique => true ==Todo * make some proxy magic so if one calls a relationship if can search the archive too * use wants rather then returning based on length * drop the id column and use the index for the model * make the doco usefull * make a generator for rails 2 and 3 == Copyright Copyright (c) 2011 SmashTank Apps, LLC. See LICENSE.txt for further details.
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
archive_2s-0.0.6 | README.rdoc |
archive_2s-0.0.5 | README.rdoc |
archive_2s-0.0.4 | README.rdoc |
archive_2s-0.0.3 | README.rdoc |
archive_2s-0.0.2 | README.rdoc |