Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A administrate
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 96
    • Issues 96
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 32
    • Merge requests 32
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • thoughtbot, inc.
  • administrate
  • Issues
  • #480
Closed
Open
Issue created Feb 22, 2016 by Administrator@rootContributor

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

Assignee
Assign to
Time tracking