|
|
@ -128,7 +128,7 @@ module ApplicationHelper
|
|
|
|
if source.class.to_s == 'User'
|
|
|
|
if source.class.to_s == 'User'
|
|
|
|
File.join(relative_path, ["#{source.class}", "#{source.id}"])
|
|
|
|
File.join(relative_path, ["#{source.class}", "#{source.id}"])
|
|
|
|
else
|
|
|
|
else
|
|
|
|
File.join("/images/avatars", ["#{source.class}", "#{source.id}"])
|
|
|
|
File.join("images/avatars", ["#{source.class}", "#{source.id}"])
|
|
|
|
end
|
|
|
|
end
|
|
|
|
elsif source.class.to_s == 'User'
|
|
|
|
elsif source.class.to_s == 'User'
|
|
|
|
str = source.user_extension.try(:gender).to_i == 0 ? "b" : "g"
|
|
|
|
str = source.user_extension.try(:gender).to_i == 0 ? "b" : "g"
|
|
|
@ -146,7 +146,7 @@ module ApplicationHelper
|
|
|
|
|
|
|
|
|
|
|
|
def shixun_url_to_avatar(shixun)
|
|
|
|
def shixun_url_to_avatar(shixun)
|
|
|
|
if File.exist?(disk_filename(shixun.class, shixun.id))
|
|
|
|
if File.exist?(disk_filename(shixun.class, shixun.id))
|
|
|
|
File.join("/images/#{relative_path}", "#{shixun.class}", "#{shixun.id}")
|
|
|
|
File.join("images/#{relative_path}", "#{shixun.class}", "#{shixun.id}")
|
|
|
|
else
|
|
|
|
else
|
|
|
|
File.join("educoder", "index", "shixun", "shixun#{rand(23)}.jpg")
|
|
|
|
File.join("educoder", "index", "shixun", "shixun#{rand(23)}.jpg")
|
|
|
|
end
|
|
|
|
end
|
|
|
|