Fixed continuous revision check

This commit is contained in:
Alexey Verkhovsky 2005-08-14 23:09:10 +00:00
parent 052754b068
commit d24cf7c8e1
3 changed files with 6 additions and 3 deletions

View file

@ -19,7 +19,7 @@ class Page < ActiveRecord::Base
# Not to record every such iteration as a new revision, if the previous revision was done # Not to record every such iteration as a new revision, if the previous revision was done
# by the same author, not more than 30 minutes ago, then update the last revision instead of # by the same author, not more than 30 minutes ago, then update the last revision instead of
# creating a new one # creating a new one
if (revisions_size > 1) && continous_revision?(time, author) if (revisions_size > 0) && continous_revision?(time, author)
current_revision.update_attributes(:content => content, :revised_at => time) current_revision.update_attributes(:content => content, :revised_at => time)
else else
Revision.create(:page => self, :content => content, :author => author, :revised_at => time) Revision.create(:page => self, :content => content, :author => author, :revised_at => time)

View file

@ -9,7 +9,10 @@ class Revision < ActiveRecord::Base
# TODO this method belongs in the view helpers (only views use it) # TODO this method belongs in the view helpers (only views use it)
def pretty_created_on def pretty_created_on
revised_on.to_date.strftime "%B %e, %Y %H:%M:%S" # Must use DateTime because Time doesn't support %e on at least some platforms
DateTime.new(
revised_at.year, revised_at.mon, revised_at.day, revised_at.hour, revised_at.min, revised_at.sec
).strftime "%B %e, %Y %H:%M:%S"
end end
# Returns an array of all the WikiIncludes present in the content of this revision. # Returns an array of all the WikiIncludes present in the content of this revision.