acts_as_catalog

acts_as_catalog is a very simple plugin providing the common infrastructure for probably the most frequent auxiliar table ever.
Download

acts_as_catalog Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Gunnar Wolf
  • Publisher web site:
  • http://rubyforge.org/projects/actsascatalog/

acts_as_catalog Tags


acts_as_catalog Description

acts_as_catalog is a very simple plugin providing the common infrastructure for probably the most frequent auxiliar table ever. acts_as_catalog is a very simple plugin providing the common infrastructure for probably the most frequent auxiliar table ever: The catalog (a small table with only an ID and a name). It provides extensions for models, migrations and tests.ModelsA catalog is defined as a table with only a +name+ column of +string+ type, and with a unique index on it (this means, does not allow for duplicate values). This plugin allows you to specify your model definition as: def Mytable < ActiveRecord::Base acts_as_catalog belongs_to :some_other_table endA catalog is often accessed to populate i.e. drop-down selection or radio boxes, passing what is called +collections+ in Rails-speak. You will often want collections to be sorted by ID or by name, thus: collection = Mytable.collection_by_id another_col = Mytable.collection_by_nameMigrationsYou can specify all the catalogs you need to create for a specific migration with a single instruction from inside your self.up method, by giving a list of catalog table names to create_catalogs: def self.up create_catalogs :countries, :states ... endLikewise, you can destroy the created catalogs in a single command. The drop_catalogs method will usually be the last thing you call in self.down: def self.up ... drop_catalogs :states, :countries endWhat's New in This Release:· Added the collection-handling class methods (collection_by_id, collection_by_name)


acts_as_catalog Related Software