Skip to content

Value at a parent node crashes the app #82

@nvanoorschot

Description

@nvanoorschot

In my db I had the following two keys with a value:

"activerecord.models.resource.name"
"activerecord.models.resource.name.one"

This was my own fault and had nothing to do with this gem. But the result is that my Rails app crashed and that I got a undefined method 'split' for nil:NilClass error that took me too long to track down This was of course a case of GIGO but still it would be nice if this gem would not produce an obscure error message.

In my fork I implemented a simple solution that silently ignores the result of the parent and only returns the children. This makes for a more forgiving gem, which I would prefer. Disadvantage here is that you might end up with unreachable translations in your db as soon as you turn a child node into a parent node.

Another approach would be to raise a specific error revealing the cause of the problem.

I'll submit a PR with my fix, but if a different solution is preferred I can have a look at it as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions