namick/obfuscate_id

Access methods to deobfuscate the ID

iamdriz opened this issue · 1 comments

In my app I pass the Obfuscated ID to my pagination and want to find Posts using it.

e.g.

before = ObfuscateId.deobfuscate_id(before)
@posts = Post.where('id < ?', before).order('created_at desc').limit(10)

But I get an error undefined method 'deobfuscate_id' for ObfuscateId:Module

Ah! Turns out it's got Class and Instance methods!

Solved it with Post.deobfuscate_id