Skip to content

Instantly share code, notes, and snippets.

@jvans1
Created July 3, 2013 22:25
Show Gist options
  • Save jvans1/5923381 to your computer and use it in GitHub Desktop.
Save jvans1/5923381 to your computer and use it in GitHub Desktop.
class InvoicePresenter < BasePresenter
def shipping_total(period_start, period_end)
company.invoices.for_period(period_start, period_end ).one_off.sum(:total)
end
end
and then in your view
presenter.shipping_total("11-1-13", "12-1-13")
this really cleans up your view logic but allows you acccess to the scopes that your controller has
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment