Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgumentError: invalid range "r-0" in string transliteration #77

Open
askehansen opened this issue Nov 26, 2021 · 0 comments
Open

ArgumentError: invalid range "r-0" in string transliteration #77

askehansen opened this issue Nov 26, 2021 · 0 comments

Comments

@askehansen
Copy link

I ran into this rare issue where I have a model PlaylistTrack and when I call find(id) it throws this error: ArgumentError: invalid range "r-0" in string transliteration.

The error is thrown from the hashids gem with @guards being "r-0" https://github.com/peterhellberg/hashids.rb/blob/b729fe514e492e18d9f69473b53eb59a3b5aee4b/lib/hashids.rb#L117

The issue was resolved after adding an explicit pepper to something else instead of the implicit "playlist_tracks":

class PlaylistTrack < ApplicationRecord
  include Hashid::Rails
  hashid_config pepper: "playlisttracks"
  ...
end

Using this pepper resulted in the @guards being "y7d" instead which is accepted.

I guess its just by chance that "playlist_tracks" produces a problematic pepper but this could potentially be a problem with other table names as well.

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

No branches or pull requests

1 participant