podemos-info/census

View on GitHub
app/queries/payment_method_last_orders.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

class PaymentMethodLastOrders < Rectify::Query
  def self.for(payment_method)
    new(payment_method).query
  end

  def initialize(payment_method)
    @payment_method = payment_method
  end

  def query
    @payment_method.orders.order(created_at: :desc).limit(3)
  end
end