From 89117389094f17fcde3c41081392f9e5828331b7 Mon Sep 17 00:00:00 2001 From: albert Date: Sat, 23 Feb 2013 16:04:09 -0500 Subject: [PATCH] fix post version diff method --- app/models/post_version.rb | 4 ++-- app/views/post_versions/_listing.html.erb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/post_version.rb b/app/models/post_version.rb index 6d6156047..27f8cb4e5 100644 --- a/app/models/post_version.rb +++ b/app/models/post_version.rb @@ -61,7 +61,7 @@ class PostVersion < ActiveRecord::Base end def sequence_for_post - versions = PostVersion.where(:post_id => post_id).order("id desc").all + versions = PostVersion.where(:post_id => post_id).order("updated_at desc").all diffs = [] versions.each_index do |i| if i < versions.size - 1 @@ -94,7 +94,7 @@ class PostVersion < ActiveRecord::Base end def previous - PostVersion.where("post_id = ? and id < ?", post_id, id).order("id desc").first + PostVersion.where("post_id = ? and id < ?", post_id, id).order("updated_at desc").first end def truncated_source diff --git a/app/views/post_versions/_listing.html.erb b/app/views/post_versions/_listing.html.erb index b7176b4b7..aa522ed4a 100644 --- a/app/views/post_versions/_listing.html.erb +++ b/app/views/post_versions/_listing.html.erb @@ -17,7 +17,7 @@ <% post_versions.each do |post_version| %> - <%= link_to(post_version.post_id, post_path(post_version.post_id)) %> + <%= link_to("#{post_version.post_id}.#{post_version.id}", post_path(post_version.post_id)) %> <%= compact_time(post_version.updated_at) %> <% if post_version.updater %>