NoMethodError is silently ignored
Created by: naps62
Following a previous issue, I added a custom field to my model:
class CurrencyCard < ActiveRecord::Base
def value
Money.from_amout(available, currency)
end
end
The above code has a typo. the method's name should be from_amount
and not from_amout
.
But the gem is swallowing the error in this rescue: https://github.com/thoughtbot/administrate/commit/351f80ba9668fa59d2d69208a8071b89f428d63f#diff-1524c94a187c1ab4bf8c2aeceebbbc35R25
I get a NoMethodError
exception, which is a descendant of NameError.
So instead of the actual error, I get a private method 'format' called for nil:NilClass
, because an unexpected nil
ended up in the view
The commit I referenced adds this to deal with polymorphic associations.
I couldn't find any tests dealing with that particular rescue
, so I'm not having a lot of luck in fixing this myself