Unable to use dynamic credentials in ftp_servers options.
Closed this issue · 3 comments
hassanakram commented
I want to use credentials from database table in ftp_servers options. Is there any way to do this ?
1). I have tried using lamda option which paperclip supports but it gives me error:
NoMethodError (undefined method `map' for #Proc:0x007fb0249b3738
has_attached_file :image, {
storage: :ftp,
path: '/Images/:filename',
url: '/images/:style/missing.png',
ftp_servers: -> (attachment) { attachment.instance.ftp_keys },
ftp_connect_timeout: 5,
ftp_ignore_failing_connections: true,
ftp_keep_empty_directories: true
}
def ftp_keys
[
{
host: 'host',
user: 'user_name',
password: 'password'
}
]
end
2). I also tried to use function but inside hash i am unable to use any class method.
boosty commented
Hi @hassanakram! I am sorry, but this is not supported at the moment (you are the first one to request that feature).
Could you contribute a PR to add support for it? I would be happy to review.
hassanakram commented
@boosty No issues.
I have created a pull request, please review it when you have time. I will be more than happy to accommodate required changes.
Thanks