Created
July 3, 2013 22:25
-
-
Save jvans1/5923381 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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