Skip to content

Commit

Permalink
Default order by timestamp to ensure early versions are cleaned
Browse files Browse the repository at this point in the history
  • Loading branch information
owenr committed Jan 17, 2016
1 parent 85733fe commit 4fdc96b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/paper_trail/cleaner.rb
Expand Up @@ -36,6 +36,7 @@ def gather_versions(item_id = nil, date = :all)
raise ArgumentError.new("`date` argument must receive a Timestamp or `:all`")
end
versions = item_id ? PaperTrail::Version.where(:item_id => item_id) : PaperTrail::Version
versions = versions.order(PaperTrail.timestamp_field)
versions = versions.between(date.to_date, date.to_date + 1.day) unless date == :all

# If `versions` has not been converted to an ActiveRecord::Relation yet,
Expand Down

0 comments on commit 4fdc96b

Please sign in to comment.