Sha256: 15b5fa2948d5d146a30101267d5e6d1f83d55fa048dca3541ba10c954403f24d

Contents?: true

Size: 673 Bytes

Versions: 1

Compression:

Stored size: 673 Bytes

Contents

# == Schema Information
#
# Table name: purchases
#
#  id          :integer          not null, primary key
#  paid        :boolean
#  commission  :decimal(, )
#  quantity    :integer
#  state       :string
#  expired_at  :datetime
#  amount      :decimal(, )
#  description :text
#  created_at  :datetime         not null
#  updated_at  :datetime         not null
#

require "enumerize"

class Purchase < ApplicationRecord
  extend Enumerize

  STATES = %i{pending canceled finished}

  enumerize :state, in: STATES, default: :pending

  humanize_attributes
  humanize :state, enumerize: true
  humanize :commission, percentage: true
  humanize :amount, currency: true
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
human_attributes-0.7.0 spec/dummy/app/models/purchase.rb