Skip to content

Instantly share code, notes, and snippets.

@jtroxel
Last active December 15, 2015 09:29
Show Gist options
  • Save jtroxel/5238846 to your computer and use it in GitHub Desktop.
Save jtroxel/5238846 to your computer and use it in GitHub Desktop.
Command objects in controllers
def approve_invoice
InvoiceSubmitedForApproval.new(current_user, params[:invoice].slice(:invoice_id)).execute
# ...
redirect_to :view_invoices
end
def view_invoices
@pending_invoices = InvoiceViewListForUser(current_user, { pending: true }).execute
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment