fixes to ad code

This commit is contained in:
albert
2013-01-06 14:05:54 -05:00
parent 9952eed85b
commit f70758da38
3 changed files with 17 additions and 2 deletions

View File

@@ -25,11 +25,15 @@ class Advertisement < ActiveRecord::Base
end
def image_url
"/images/advertisements/#{file_name}"
"/images/advertisements/ads-#{date_prefix}/#{file_name}"
end
def date_prefix
created_at.strftime("%Y%m%d")
end
def image_path
"#{Rails.root}/public/images/advertisements/#{file_name}"
"#{Danbooru.config.advertisement_path}/ads-#{date-prefix}/#{file_name}"
end
def file

View File

@@ -87,6 +87,11 @@ module Danbooru
nil
end
# Where the ad banners are stored in the file system
def advertisement_path
nil
end
# List of memcached servers
def memcached_servers
%w(localhost:11211)

View File

@@ -50,6 +50,12 @@ namespace :data do
task :link_directories do
run "rm -f #{release_path}/public/data"
run "ln -s #{deploy_to}/shared/data #{release_path}/public/data"
run "rm -f #{release_path}/public/ssd"
run "ln -s /mnt/ssd#{release_path}/public #{release_path}/public/ssd"
run "rm -f #{release_path}/public/images/advertisements"
run "ln -s #{deploy_to}/shared/advertisements #{release_path}/public/images/advertisements"
end
end