fix post version diff method
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<tbody>
|
||||
<% post_versions.each do |post_version| %>
|
||||
<tr id="post-version-<%= post_version.id %>">
|
||||
<td><%= link_to(post_version.post_id, post_path(post_version.post_id)) %></td>
|
||||
<td><%= link_to("#{post_version.post_id}.#{post_version.id}", post_path(post_version.post_id)) %></td>
|
||||
<td><%= compact_time(post_version.updated_at) %></td>
|
||||
<td>
|
||||
<% if post_version.updater %>
|
||||
|
||||
Reference in New Issue
Block a user