Sha256: bb7804244a2f05f525cc15752f776a401ca23a3359e3f948674aaf467b803bce

Contents?: true

Size: 667 Bytes

Versions: 1

Compression:

Stored size: 667 Bytes

Contents

class Order < ActiveRecord::Base
  belongs_to :order_list
  belongs_to :purchase_request

  validates :purchase_request_id, uniqueness: { scope: :order_list_id }

  after_save :reindex
  after_destroy :reindex

  acts_as_list scope: :order_list

  paginates_per 10

  def reindex
    purchase_request.try(:index)
  end
end

# == Schema Information
#
# Table name: orders
#
#  id                  :integer          not null, primary key
#  order_list_id       :integer          not null
#  purchase_request_id :integer          not null
#  position            :integer
#  state               :string
#  created_at          :datetime
#  updated_at          :datetime
#

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enju_purchase_request-0.3.2 app/models/order.rb