Permalink
Browse files

Change all ocorrences of "instance.attachment" to self

  • Loading branch information...
1 parent dacb366 commit 3c864fbb0e6a735588573bcc2313ffa9bc62dbca @reinaldomendes reinaldomendes committed Sep 8, 2011
Showing with 5 additions and 4 deletions.
  1. +5 −4 lib/attachment_on_the_fly.rb
@@ -57,9 +57,9 @@ def generate_image(kind, height = 0, width = 0)
elsif kind == "both"
prefix = "S_" + height.to_s + "_" + height.to_s + "_"
end
-
- path = instance.attachment.path
- url = instance.attachment.url
+
+ path = self.path
+ url = self.url
path_arr = path.split("/")
file_name = path_arr.pop
@@ -69,7 +69,7 @@ def generate_image(kind, height = 0, width = 0)
url_file_name = url_arr.pop
url_path = url_arr.join("/")
- original = path + "/" + instance.attachment.original_filename
+ original = path + "/" + self.original_filename
newfilename = path + "/" + prefix + file_name
new_path = url_path + "/" + prefix + file_name
@@ -113,3 +113,4 @@ def generate_image(kind, height = 0, width = 0)
end
class AttachmentOnTheFlyError < StandardError; end
+

0 comments on commit 3c864fb

Please sign in to comment.