Rails/Dragonfly: is it possible to decode URL (/media/W1siZiIsInRzYW...) to get the model instance it refers to? -


this want accomplish:

on extranet feed wall, users type non-formatted text (non style, \n , links recognition).

but quite often, users want add link document stored in same extranet (using dragonfly). obviously, link quite awful display (ex: https://extranet.com/media/l0nguid/original_filename.pdf?sha=31310881daef1). document refers document instance has nice title, ex: "original filename (pdf)" links (automatically) replaced by

<a href="https://extranet.com/media/l0nguid/original_filename.pdf?sha=31310881daef1">original filename (pdf)</a> 

problem is: how find model , document document refers to, using uid , sha.

i guess possible dragonfly decodes url, can't find how (not comments in code).

the variant's uid base64 encoded, when decoding uid json encoded array of dragonfly processor steps.

here actual example live database:

uid = 'w1siziisijiwmtuvmdcvmdkvmdkvmtmvmdivote3lze5ndg3odk0mdc1xze4ngyzmjc0mwvfay5qcgcixv0' base64.decode64 uid # => "[[\"f\",\"2015/07/09/09/13/02/917/19487894075_184f32741e_k.jpg\"]]" 

each step array step's operation in first element , step's arguments in remaining.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -