Sha256: c0b8414ea20caa847acb392834a655e7b7cebf7437f4e964ed2c8c244463af03

Contents?: true

Size: 674 Bytes

Versions: 5

Compression:

Stored size: 674 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 < ActiveRecord::Base
  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

5 entries across 5 versions & 1 rubygems

Version Path
human_attributes-0.6.0 spec/dummy/app/models/purchase.rb
human_attributes-0.5.0 spec/dummy/app/models/purchase.rb
human_attributes-0.4.0 spec/dummy/app/models/purchase.rb
human_attributes-0.3.1 spec/dummy/app/models/purchase.rb
human_attributes-0.3.0 spec/dummy/app/models/purchase.rb