Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Upgrading

beerlington edited this page · 2 revisions
Clone this wiki locally

Guide to upgrading between versions

Upgrading from 3.x to 4.x

Rails and Ruby version changes

ClassyEnum 4.0 supports Rails >= 3.2.x and Ruby >= 1.9.3. If you want to use ClassyEnum >= 4.0, you will need to be running at least these versions.

ClassyEnum::ActiveRecord must be included in models

ClassyEnum is no longer included in all Active Record classes and must be explicitly included in any Active Record classes you want to use it with.

Before

class Alarm < ActiveRecord::Base
  classy_enum_attr :priority
end

Now

class Alarm < ActiveRecord::Base
  include ClassyEnum::ActiveRecord

  classy_enum_attr :priority
end

Removal of serialize_as_json option

The serialize_as_json option has been removed in favor of overriding #as_json in your enum subclasses.

Upgrading from 2.x to 3.x

See notes below if moving from 1.x to 3.x

In addition to some removing a few unnecessary methods, there are changes to how enum classes are defined. The enum_classes macro has been removed in favor of inferring them from the subclass names. Subclasses must now follow a naming convention that uses the parent class as a namespace:

Before:

class Parent < ClassyEnum::Base
  enum_classes :child1, :child2
end

class ParentChild1 < Parent
end

class ParentChild2 < Parent
end

Now:

class Parent < ClassyEnum::Base
end

class Parent::Child1 < Parent
end

class Parent::Child2 < Parent
end

Upgrading from 1.x to 3.x

Prior to 2.0, enum classes were implicity defined and were only required when overriding methods or properties. As of 2.0, all enum classes must explicity subclass a child of ClassyEnum::Base. If you used the generator, there are no changes to the existing structure.

Built-in Formtastic support has been removed. See the note at the bottom of this readme for more information how how to enable it.

Something went wrong with that request. Please try again.