Comment

Comment by twiss

    class Order < ActiveRecord::Base
      enum :status, { pending: 0, paid: 1, shipped: 2, refunded: 3 }

      def shippable?
        paid? && !refunded?
      end
    end
Bit off-topic but if `:status` is an enum, then `paid? && !refunded?` is equivalent to `paid?`
parent twiss 7 days ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton