e4595d934 breaks shit #267

Closed
stevenbristol opened this Issue Aug 31, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@stevenbristol
Contributor

stevenbristol commented Aug 31, 2012

e4595d9 assumes the the ARel is for the same class, in which case this works fine. If however, if the ARel is for an association then this change breaks calls to methods on those objects.

This change should be reverted.

For example:

class DashboardDecorator < ApplicationDecorator

  decorates :business
  decorates_association :expenses
  decorates_association :deposits


  def invoiced_last_30
    invoices.sent_range( (Date.today-30)..Date.today).sum( :total).c
#sent_range is NoMethodError
#I shouldn't have to decorates_association everything
  end

  def active_bank_accounts_get_accountless_unless_zero
    total = expenses.accountless.sum(:amount) + deposits.accountless.sum(:amount)
# without expenses being decorates_association accountless would be NoMethodError
# with expenses being decorates_association "+" is NoMethodError
    return nil unless total > 0
    {name: "Accountless", currency_symbol: currency.html_symbol, balance: total.c, id: -1}
  end

end
@steveklabnik

This comment has been minimized.

Show comment Hide comment
@steveklabnik

steveklabnik Aug 31, 2012

Owner

I don't like to break stuff. @jshu if you can come up with something that addresses @stevenbristol's concerns, I'd love to include the feature. I knew something was bothering me about all the Relation stuff :p

Owner

steveklabnik commented Aug 31, 2012

I don't like to break stuff. @jshu if you can come up with something that addresses @stevenbristol's concerns, I'd love to include the feature. I knew something was bothering me about all the Relation stuff :p

@steveklabnik

This comment has been minimized.

Show comment Hide comment
@steveklabnik

steveklabnik Aug 31, 2012

Owner

I'm gonna try to put out a release on Monday, but if we don't get something in before then, we can work on it for the next release.

Owner

steveklabnik commented Aug 31, 2012

I'm gonna try to put out a release on Monday, but if we don't get something in before then, we can work on it for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment