Bundling boolean attributes with enum in Rails

Boolean attributes at ActiveRecords models are a code smell. They often are abused to represent a specific status. Though it is reasonable to use them for a single status, states tend to become various. Then it makes sense to consider alternatives.
One is to extract the status values into a separate table and reference them accordingly. That route is less reasonable for static (mostly few) values without any logic tied to it.
Another alternative is the ActiveRecord enum (since Rails 4), if the states are not mutually exclusive (one state at a time).

Original: boolean attributes

Based on a Product model with the three states sold, delivered und complained:

$ rails g model Product serial:string sold:boolean delivered:boolean complained:boolean

and the corresponding tests:

require 'spec_helper'

describe Product, type: :model do
  subject { Product.new serial: '123' }                                            
  it { is_expected.to have_db_column(:sold).of_type(:boolean) }
  it { is_expected.to have_db_column(:delivered).of_type(:boolean) }
  it { is_expected.to have_db_column(:complained).of_type(:boolean) }

  describe ".sold" do
    it "should return all sold products" do
      subject.sold = true
      expect(Product.sold).to eq([subject])

The model contains only one named scope. It is easy to imagine, how the tests and the model would have to look like, if there was a scope required for each status:

class Product < ActiveRecord::Base
  scope :sold, -> { where(sold: true) }

Alternative: enum

Enum requires an Integer attribute (in this case state) for persistence:

$ rails g model Product serial:string state:integer:index

The enum attribute is declared with values like:

class Product < ActiveRecord::Base
  enum state: [:sold, :delivered, :complained]

Basically the principle is: the meaningful values (sold, delivered and complained) are mapped to Integers and persisted by Rails. And vice versa for reading.
Furthermore the named scopes at the model class are defined automatically. The same applies for the object accessors:

Product.sold # =>  #<ActiveRecord::Relation []>
Product.new.sold? # => false
Product.states # => {"sold"=>0, "delivered"=>1, "complained"=>2}

Besides it is easy to add more states, if necessary, without the need to change the database schema itself. It is sufficient to add one more value to the status Array.
Thank Shoulda Matchers there is just one single test left:

require 'spec_helper'

describe Produc, type: :model do
  subject { Product.new }

  it { is_expected.to define_enum_for(:state).with([:sold, :delivered, :complained]) }

But please note, that when an Array is used, the implicit mapping from the values to database integers is derived from the order the values appear in the array. That means 0 for sold, 1 for delivered and 2 for complained.
However the mapping values also can defined explicitly:

class Product < ActiveRecord::Base
  enum state: { sold: 10, delivered: 20, complained: 30 }

The Hash version makes it possible to refactor the status for existing objects.