refactor optimized_image a bit

This commit is contained in:
Régis Hanol 2013-07-10 22:56:25 +02:00
parent ffb9a1250a
commit ac41e94619
1 changed files with 3 additions and 7 deletions

View File

@ -49,19 +49,15 @@ class OptimizedImage < ActiveRecord::Base
end
def url
"#{Upload.base_url}/#{optimized_path}/#{filename}"
"#{LocalStore.base_url}/#{optimized_path}/#{filename}"
end
def path
"#{path_root}/#{optimized_path}/#{filename}"
end
def path_root
@path_root ||= "#{Rails.root}/public"
"#{LocalStore.base_path}/#{optimized_path}/#{filename}"
end
def optimized_path
"uploads/#{RailsMultisite::ConnectionManagement.current_db}/_optimized/#{sha1[0..2]}/#{sha1[3..5]}"
"_optimized/#{sha1[0..2]}/#{sha1[3..5]}"
end
def filename