Sha256: cf787bb607424240b26fb3e2e86313fee5df83dab519e9de4a060b34639fb60f

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

h1. enum_type -- Enumerated Types in ActiveRecord

| *Author* | Tim Morgan |
| *Version* | 1.0 (Oct 29, 2010) |
| *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 @enum_type@ method documentation for more information.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enum_type-1.0.0 README.textile