我正在使用回形针并以下列方式将路径网址设为
has_attached_file :avatar,
:path => ":rails_root/app/assets/images/:basename.:extension"
问题是我需要加密basename属性,okey rails有一个函数crypt,但是如何将它用于路由,如下所示:
has_attached_file :avatar,
:path => ":rails_root/app/assets/images/#{:basename.crypt('key')}.:extension"
答案 0 :(得分:0)
看看是否有效
has_attached_file :avatar,
:path => ":rails_root/app/assets/images/#{Paperclip::Interpolations.basename.crypt('key')}.:extension"