Sha256: da21181dd148fc1b0ae94b1be952fb4caa9677b317e64760528e20a0adbdc166

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

h1. enum_type -- Enumerated Types in ActiveRecord

| *Author* | Tim Morgan |
| *Version* | 2.1 (May 14, 2012) |
| *License* | Released under the MIT license. |

h2. About

@enum_type@ allows you to effectively use the PostgreSQL @ENUM@ data type in
your ActiveRecord models. It's a really simple gem that just adds a convenience
method to take care of the usual "witch chant" that accompanies building an
enumerated type in Rails.

h2. Installation

*Important Note:* This gem requires Ruby 1.9. Ruby 1.8 is not supported, and
will never be.

First, add the @enum_type@ gem to your @Gemfile@:

<pre><code>
gem 'enum_type'
</code></pre>

Then, extend your model with the @EnumType@ module:

<pre><code>
class MyModel < ActiveRecord::Base
  extend EnumType
end
</code></pre>

h2. Usage

In your model, call the @enum_type@ method, providing one or more enumerated
fields, and any additional options:

<pre><code>
class MyModel < ActiveRecord::Base
  extend EnumType
  enum_type :status, %w( active pending admin superadmin banned )
end
</code></pre>

See the {EnumType#enum_type} method documentation for more information.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
enum_type-2.1.1 README.textile
enum_type-2.1.0 README.textile