mongoid-enum/README.md
Nicholas Bruning d7c07e03ff Initial commit
2013-11-04 23:30:10 +11:00

597 B

Mongoid::Enum

Heavily inspired by DHH's ActiveRecord::Enum, this little library is really just a good tablespoon of syntactik sugar.

Usage

class Payment

enum :status, [:pending, :approved, :declined],

end

  • Stores as _status, accessible from status and status=.
  • Automatically validates against :options
  • Stored as a string, but always expressed as a symbol. Access is indifferent (or masks said behaviour

Options

:multiple

Changes storage to _status_array, and allows for the storage of multiple options.

Should also include some finders!

Payment.declined, etc..