You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now you can create collisions by doing something like
config.add :actor, {
1 => 'A',
1 => 'B'
}
If you did something like this, all references to 'A' will become references to 'B' and that could be catastrophic.
A mechanism should be added so that this is prevented at a code level.
The text was updated successfully, but these errors were encountered:
What if instead of a hash we use an array to define mappings? This way, we can iterate on that array, and check for duplicate keys. Not as clean as using a hash, and breaks the current API, but solves the problem:
config.add :actor, [
[1, 'A'],
[1, 'B']
]
Using hash its impossible to detect this. Ruby emits a warning, but I think that's no way to handle this...
x = {1=> 'A', 1=> 'B'}
warning: key 1 is duplicated and overwritten on line 3
Right now you can create collisions by doing something like
If you did something like this, all references to 'A' will become references to 'B' and that could be catastrophic.
A mechanism should be added so that this is prevented at a code level.
The text was updated successfully, but these errors were encountered: