@@ -175,7 +175,7 class Attachment < ActiveRecord::Base | |||
|
175 | 175 | def self.find_by_token(token) |
|
176 | 176 | if token.to_s =~ /^(\d+)\.([0-9a-f]+)$/ |
|
177 | 177 | attachment_id, attachment_digest = $1, $2 |
|
178 |
attachment = Attachment. |
|
|
178 | attachment = Attachment.where(:id => attachment_id, :digest => attachment_digest).first | |
|
179 | 179 | if attachment && attachment.container.nil? |
|
180 | 180 | attachment |
|
181 | 181 | end |
@@ -200,8 +200,7 class Attachment < ActiveRecord::Base | |||
|
200 | 200 | end |
|
201 | 201 | |
|
202 | 202 | def self.prune(age=1.day) |
|
203 |
|
|
|
204 | attachments.each(&:destroy) | |
|
203 | Attachment.where("created_on < ? AND (container_type IS NULL OR container_type = '')", Time.now - age).destroy_all | |
|
205 | 204 | end |
|
206 | 205 | |
|
207 | 206 | private |
General Comments 0
You need to be logged in to leave comments.
Login now