public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Search Repo:
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
tweak to Asset so it doesn't lose thumbnails when the asset itself is 
edited [Aubrey]
technoweenie (author)
Tue Mar 04 01:36:46 -0800 2008
commit  3afcdaeac833515e2378c826fca7b1505aa48bb4
tree    73a3a59801344c791a27f7372a62dfbe9f9e718d
parent  9c610fccc09a0ea54393685b10d27f93c53baf8c
...
85
86
87
88
 
89
90
91
...
85
86
87
 
88
89
90
91
0
@@ -85,7 +85,7 @@
0
 
0
   protected
0
     def rename_unique_filename
0
- if (@old_filename || new_record?) && errors.empty? && site_id && filename
0
+ if ((@old_filename && !@old_filename.eql?(full_filename)) || new_record?) && errors.empty? && site_id && filename
0
         i = 1
0
         pieces = filename.split('.')
0
         ext = pieces.size == 1 ? nil : pieces.pop
...
44
45
46
 
 
 
 
 
 
 
47
48
49
...
44
45
46
47
48
49
50
51
52
53
54
55
56
0
@@ -44,6 +44,13 @@
0
     assert_file_exists File.join(ASSET_PATH, now.year.to_s, now.month.to_s, now.day.to_s, "logo_1.png")
0
   end
0
 
0
+ def test_should_not_rename_file_on_update
0
+ asset = process_upload
0
+ old_filename = asset.filename
0
+ asset.update_attributes({ :filename => 'logo.png' })
0
+ assert_equal old_filename, asset.filename
0
+ end
0
+
0
   def test_should_upload_file_in_multi_sites_mode
0
     Site.multi_sites_enabled = true
0
     process_upload

Comments

    No one has commented yet.