Craig White
2006-Jul-03 22:24 UTC
[Rails] staying in control over the case in file_column plugin
using file_column plugin, if I upload IMG0001.JPG, I get files similarly named IMG0001-thumb.JPG, etc. but if I upload img00002.jpg, I get files img00002-thumb.jpg, etc. This is tacky in terms of my counting on a consistency when implementing views. My inclination is to start hacking away at this section of file_column.rb: class PermanentUploadedFile < RealUploadedFile # :nodoc: def initialize(*args) super *args @dir = File.join(store_dir,@instance.id.to_s) @filename = @instance[@attr] @filename = nil if @filename.empty? end something like @filename = @instance.lower[@attr] instead of @filename = @instance[@attr] but before I start hacking brilliantly conceptualized code with illogical luck, I wonder if I am not not missing something somewhere that would make this much simpler. Craig
Craig White
2006-Jul-05 13:13 UTC
[Rails] staying in control over the case in file_column plugin
I''m still hoping to get some feedback on this... On Mon, 2006-07-03 at 15:24 -0700, Craig White wrote:> using file_column plugin, if I upload IMG0001.JPG, I get files similarly > named IMG0001-thumb.JPG, etc. but if I upload img00002.jpg, I get files > img00002-thumb.jpg, etc. > > This is tacky in terms of my counting on a consistency when implementing > views. > > My inclination is to start hacking away at this section of > file_column.rb: > > class PermanentUploadedFile < RealUploadedFile # :nodoc: > def initialize(*args) > super *args > @dir = File.join(store_dir,@instance.id.to_s) > @filename = @instance[@attr] > @filename = nil if @filename.empty? > end > > something like > @filename = @instance.lower[@attr]---- probably should be downcase and not lower ----> instead of > @filename = @instance[@attr] > > but before I start hacking brilliantly conceptualized code with > illogical luck, I wonder if I am not not missing something somewhere > that would make this much simpler. > > Craig