Skip to content

Conversation

@kakra
Copy link

@kakra kakra commented Jul 10, 2015

The problem here is:

{ errors: nil }.fetch(:errors, {}) #==> nil

but the code expects:

({ errors: nil }.fetch(:errors) || {}) #==> {}

for the chained #fetch to work.

These patches fix the two problematic lines, though a more sophisticated patch should fix why in fields_for can the key exists with a nil value in first place.

kakra added 3 commits July 10, 2015 14:11
The problem here is:

    { errors: nil }.fetch(:errors, {}) #==> nil

but the code expects:

    ({ errors: nil }.fetch(:errors) || {}) #==> {}

for the chained ```#fetch``` to work.

This patch fixes it, though a more sophisticated patch should fix why in ```fields_for``` can the key exists with a nil value in first place.
Without the default option, ```#fetch``` won't full back but report "key not found".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant