Skip to content

Instantly share code, notes, and snippets.

@joegaudet
Last active August 8, 2018 22:10
Show Gist options
  • Save joegaudet/5275d9723149cfbfa667bf5a884d0146 to your computer and use it in GitHub Desktop.
Save joegaudet/5275d9723149cfbfa667bf5a884d0146 to your computer and use it in GitHub Desktop.
module Invocing
module Queries
class FindClientInvoiceByOrder
dependency :client_invoice_dao, ClientInvoice
def call(order_id)
ClientInvoice.includes(:line_items).find_by(order_id: order_id)
end
def self.call(order)
new.(order.id)
end
end
end
end
client_invoice = Invoicing::Queries::FindClientInvoiceByOrder.(order)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment