show description diffs in pool version listing

This commit is contained in:
Albert Yi
2017-01-03 14:40:53 -08:00
parent 3d2b81d1e8
commit 4859a803c6
2 changed files with 9 additions and 0 deletions

View File

@@ -12,6 +12,11 @@ module PoolVersionsHelper
'<del><a href="/posts/' + post_id.to_s + '">' + post_id.to_s + '</a></del>'
end.join(" ")
if pool_version.description_changed?
html << '<ins>desc:' + h(pool_version.description) + '</ins> '
html << '<del>desc:' + h(pool_version.previous.description) + '</del> '
end
return html.html_safe
end
end

View File

@@ -59,6 +59,10 @@ class PoolArchive < ActiveRecord::Base
sqs_service.send_message(msg)
end
def previous
PoolArchive.where("pool_id = ? and version < ?", pool_id, version).order("version desc").first
end
def pool
Pool.find(pool_id)
end