Skip to content

Instantly share code, notes, and snippets.

@xhoy
Last active March 17, 2016 14:33
Show Gist options
  • Save xhoy/c04d207c3fe1bc466fe7 to your computer and use it in GitHub Desktop.
Save xhoy/c04d207c3fe1bc466fe7 to your computer and use it in GitHub Desktop.
DOES NOT WORK:
{% for invoice in relation.invoices.late %}
<tr>
<td>{{invoice.id}}</td>
<td>{{invoice.print_date}}</td>
<td>{{invoice.days_late}}</td>
<td>{{invoice.priceinbtw}}</td>
</tr>
{% endfor %}
DOES WORK
{% for invoice in relation.invoices %}
<tr>
<td>{{invoice.id}}</td>
<td>{{invoice.print_date}}</td>
<td>{{invoice.days_late}}</td>
<td>{{invoice.priceinbtw}}</td>
</tr>
{% endfor %}
class Relation < ActiveRecord::Base
has_many :invoices
liquid_methods :full_name, :invoices, :letter_head
end
class Invoice < ActiveRecord::Base
scope :late, -> {unpayed.where("print_date < ? ", (Time.now-APP_CONFIG['betaalinformatie']['termijn'].days))}
liquid_methods :days_late, :priceinbtw, :print_date, :id, :late, :unpayed
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment