optimize string replacment

This commit is contained in:
Arpit Jalan 2015-10-21 13:43:20 +05:30
parent 976692b387
commit 1821ba8d93

View File

@ -87,12 +87,12 @@ module Email
# http://www.ietf.org/rfc/rfc2919.txt # http://www.ietf.org/rfc/rfc2919.txt
if topic && topic.category && !topic.category.uncategorized? if topic && topic.category && !topic.category.uncategorized?
list_id = "<#{topic.category.name.downcase.split(' ').join('-')}.#{host}>" list_id = "<#{topic.category.name.downcase.gsub(' ', '-')}.#{host}>"
# subcategory case # subcategory case
if !topic.category.parent_category_id.nil? if !topic.category.parent_category_id.nil?
parent_category_name = Category.find_by(id: topic.category.parent_category_id).name parent_category_name = Category.find_by(id: topic.category.parent_category_id).name
list_id = "<#{topic.category.name.downcase.split(' ').join('-')}.#{parent_category_name.downcase.split(' ').join('-')}.#{host}>" list_id = "<#{topic.category.name.downcase.gsub(' ', '-')}.#{parent_category_name.downcase.gsub(' ', '-')}.#{host}>"
end end
else else
list_id = "<#{host}>" list_id = "<#{host}>"