This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
README
== has_states +has_states+ adds support for managing states, events, and transitions within a model. == Resources Announcement * http://www.pluginaweek.org Wiki * http://wiki.pluginaweek.org/Has_states API * http://api.pluginaweek.org/has_states Development * http://dev.pluginaweek.org/browser/trunk/plugins/active_record/has/has_states Source * http://svn.pluginaweek.org/trunk/plugins/active_record/has/has_states == Description State machines make it dead-simple to manage the behavior of a model. Too often, the status of a record is kept by creating multiple boolean columns in the table and deciding how to behave based on the values in those columns. This can become cumbersome and difficult to maintain when the complexity of your models starts to increase. +has_states+ simplifies this design by introducing the various parts of a state machine, including states, events, and transitions. However, its api is designed to be similar to ActiveRecord in terms of validations and callbacks, making it so simple you don't even need to know what a state machine is :) == Usage === Running migrations To migrate the tables required for has_states, you can either run the migration from the command line like so: rake db:migrate:plugins PLUGIN=has_states or (more ideally) generate a migration file that will integrate into your main application's migration path: ruby script/generate plugin_migration has_states == Testing Before you can run any tests, the following gems must be installed: * plugin_test_helper[http://wiki.pluginaweek.org/Plugin_test_helper] * dry_validity_assertions[http://wiki.pluginaweek.org/Dry_validity_assertions] == Tools Jean Bovet - {Visual Automata Simulator}[http://www.cs.usfca.edu/~jbovet/vas.html]. This is a great tool for "simulating, visualizing and transforming finite state automata and Turing Machines". This tool can help in the creation of states and events for your models. It is cross-platform, written in Java. == Dependencies This plugin depends on the presence of the following plugins: * class_associations[http://wiki.pluginaweek.org/Class_associations] * custom_callbacks[http://wiki.pluginaweek.org/Custom_callbacks] * dry_transaction_rollbacks[http://wiki.pluginaweek.org/Dry_transaction_callbacks] * eval_call[http://wiki.pluginaweek.org/Eval_call] This plugin is also plugin+. That means that it contains a slice of an application, such as models and migrations. To test or use a plugin+, you must have the following plugins/gems installed: * plugin_dependencies[http://wiki.pluginaweek.org/Plugin_dependencies] * loaded_plugins[http://wiki.pluginaweek.org/Loaded_plugins] * appable_plugins[http://wiki.pluginaweek.org/Appable_plugins] * plugin_migrations[http://wiki.pluginaweek.org/Plugin_migrations] Instead of installing each individual plugin+ feature, you can install them all at once using the plugins+[http://wiki.pluginaweek.org/Plugins_plus] meta package, which contains all additional features. == References * Scott Barron - acts_as_state_machine[http://elitists.textdriven.com/svn/plugins/acts_as_state_machine]








