module PoolVersionsHelper
def pool_version_diff(current)
prev = PoolVersion.where(["pool_id = ? and updated_at < ?", current.pool_id, current.updated_at]).order("updated_at desc").first
if prev.nil?
return current.post_id_array.map {|x| '' + x.to_s + ''}.join(" ").html_safe
end
added = current.post_id_array - prev.post_id_array
removed = prev.post_id_array - current.post_id_array
(added.map {|x| '' + x.to_s + ''}.join(" ") + " " + removed.map {|x| '' + x.to_s + ''}.join(" ")).html_safe
end
end