Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I just fixed a regression on the simple_form integration module, I’m sorry! I guess we need some tests, but that’s OK for now :)
It blew up with a collection like this, which previously worked:
Note that it also accepts an input format like this (shown in the README file):
I also needed to changed the format of the hash returned by “Foo.collection_i18n” to something more useful. It was in the following format: { ‘Translated key’ => integer code }. I realized the integer code had little to no use, because integer codes are meant to be used internally by the model. They shouldn’t be needed on the views. I guess the “Foo.statuses” (or similar) method that comes with Rails is meant for querying the database, and I see little use outside that context. For example:
The new i18n collection hash can be used like this, which is much more useful:
That method is also useful because:
I also retired the “except” option previously accepted by the i18n collection method. Now that the keys are the enum identifiers, we don’t need that anymore. Instead we can do:
I’ll be glad to hear an opinion from you, thanks.