class Request < ActiveRecord::Base
  before_create :defaultly_unfulfilled

  has_many :messages
  has_many :transactions

  belongs_to :requester, class_name: 'User'
  belongs_to :responder, class_name: 'User'
  belongs_to :group

  validates :content, :requester, :group, presence: true
  validates :is_fulfilled, inclusion: { in: [true, false] }

  def active?
    # placeholder, must put logic here
    true
  end

  def other_party
    if current_user == requester
      responder
    elsif current_user == responder
      requester
    end
  end

  private

  def defaultly_unfulfilled
    self.is_fulfilled = false
    true
  end
end

class Request < ActiveRecord::Base
  before_create :defaultly_unfulfilled

  has_many :messages
  has_many :transactions

  belongs_to :requester, class_name: 'User'
  belongs_to :responder, class_name: 'User'
  belongs_to :group

  validates :content, :requester, :group, presence: true
  validates :is_fulfilled, inclusion: { in: [true, false] }

  def active?
    # placeholder, must put logic here
    true
  end

  private

  def defaultly_unfulfilled
    self.is_fulfilled = false
    true
  end
end

Remove other_party getter from model"
Remove other_party getter from model"
