Skip to content

Commit d20243e

Browse files
author
Tim Glen
committed
Replaced all references to Attachment to either ::Attachment or self
1 parent e0a48a5 commit d20243e

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

app/controllers/cms/attachments_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Cms::AttachmentsController < Cms::BaseController
22
def show
3-
@attachment = Attachment.find(params[:id])
3+
@attachment = ::Attachment.find(params[:id])
44
@attachment = @attachment.as_of_version(params[:version]) if params[:version]
55
send_file(@attachment.full_file_location,
66
:filename => @attachment.file_name,

app/controllers/cms/content_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def try_to_stream_file
102102
unless ext.blank?
103103

104104
#Check access to file
105-
@attachment = Attachment.find_live_by_file_path(@path)
105+
@attachment = ::Attachment.find_live_by_file_path(@path)
106106
if @attachment
107107
raise Cms::Errors::AccessDenied unless current_user.able_to_view?(@attachment)
108108

app/models/attachment.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def self.storage_location=(storage_location)
144144
end
145145

146146
def self.find_live_by_file_path(file_path)
147-
Attachment.published.not_archived.first(:conditions => {:file_path => file_path})
147+
self.published.not_archived.first(:conditions => {:file_path => file_path})
148148
end
149149

150150
#----- Instance Methods ------------------------------------------------------
@@ -180,7 +180,7 @@ def public?
180180
end
181181

182182
def full_file_location
183-
File.join(Attachment.storage_location, file_location)
183+
File.join(self.class.storage_location, file_location)
184184
end
185185

186186
# Forces this record to be changed, even if nothing has changed

lib/cms/behaviors/attaching.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def file_size
159159

160160
def after_as_of_version
161161
if attachment_id && attachment_version
162-
self.attachment = Attachment.find(attachment_id).as_of_version(attachment_version)
162+
self.attachment = ::Attachment.find(attachment_id).as_of_version(attachment_version)
163163
end
164164
end
165165

0 commit comments

Comments
 (0)