0
0
Fork 0

Fix #2848 - Rake task to redownload avatars/headers (#4156)

Can be filtered by a specific domain
Resolves #2292
This commit is contained in:
Eugen Rochko 2017-07-11 17:25:49 +02:00 committed by GitHub
parent f93de3a516
commit e6c81a635b
3 changed files with 31 additions and 9 deletions

View file

@ -6,8 +6,9 @@ module Remotable
included do
attachment_definitions.each_key do |attachment_name|
attribute_name = "#{attachment_name}_remote_url".to_sym
method_name = "#{attribute_name}=".to_sym
attribute_name = "#{attachment_name}_remote_url".to_sym
method_name = "#{attribute_name}=".to_sym
alt_method_name = "reset_#{attachment_name}!".to_sym
define_method method_name do |url|
begin
@ -35,6 +36,15 @@ module Remotable
nil
end
end
define_method alt_method_name do
url = self[attribute_name]
return if url.blank?
self[attribute_name] = ''
send(method_name, url)
end
end
end
end