From 8f9f24f3833043de2da9a6a95e7dc2be535d11f3 Mon Sep 17 00:00:00 2001 From: maxwell Date: Fri, 18 Mar 2011 19:00:24 -0700 Subject: [PATCH] fix for photo urls before they are processed --- app/models/photo.rb | 2 +- spec/models/photo_spec.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/photo.rb b/app/models/photo.rb index dd9700ad5..fb6bd526a 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -70,7 +70,7 @@ class Photo < Post end def url(name = nil) - if self.not_processed? || self.image.path.include? '.gif' + if self.not_processed? || (!self.image.path.blank? && self.image.path.include?('.gif')) image.url elsif remote_photo_path name = name.to_s + '_' if name diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb index 240a9ca8f..482937c27 100644 --- a/spec/models/photo_spec.rb +++ b/spec/models/photo_spec.rb @@ -14,7 +14,9 @@ describe Photo do @fail_fixture_name = File.join(File.dirname(__FILE__), '..', 'fixtures', 'msg.xml') @photo = @user.build_post(:photo, :user_file=> File.open(@fixture_name), :to => @aspect.id) + @photo.processed = true @photo2 = @user.build_post(:photo, :user_file=> File.open(@fixture_name), :to => @aspect.id) + @photo2.processed = true end describe "protected attributes" do