don't record pool history without change (#1189)

This commit is contained in:
Toks
2013-04-22 21:33:43 -04:00
parent 3994932a20
commit 66290a3401

View File

@@ -235,12 +235,14 @@ class Pool < ActiveRecord::Base
end
def create_version
last_version = versions.last
if post_ids_changed? || name_changed? || description_changed? || is_active_changed? || is_deleted_changed?
last_version = versions.last
if last_version && CurrentUser.ip_addr == last_version.updater_ip_addr && CurrentUser.id == last_version.updater_id
last_version.update_column(:post_ids, post_ids)
else
versions.create(:post_ids => post_ids)
if last_version && CurrentUser.ip_addr == last_version.updater_ip_addr && CurrentUser.id == last_version.updater_id
last_version.update_column(:post_ids, post_ids)
else
versions.create(:post_ids => post_ids)
end
end
end