lib/paperclip/storage/database.rb in paperclip_database-2.3.0 vs lib/paperclip/storage/database.rb in paperclip_database-2.3.1

- old
+ new

@@ -80,11 +80,11 @@ ActiveRecord::Base.logger.info("[paperclip] Database Storage Initalized.") end def setup_paperclip_files_association - @paperclip_files_association_name = 'paperclip_files' + @paperclip_files_association_name = @paperclip_file_model.name.demodulize.tableize @database_table = @paperclip_file_model.table_name #FIXME: This fails when using set_table_name "<myname>" in your model #FIXME: This should be fixed in ActiveRecord... instance.class.has_many(@paperclip_files_association_name.to_sym, :class_name => @paperclip_file_model.name, @@ -167,9 +167,13 @@ nil end end alias_method :to_io, :to_file + + def files + instance.send("#{@paperclip_files_association_name}") + end def file_for(style) db_result = instance.send("#{@paperclip_files_association_name}").send(:file_for, style.to_s) raise RuntimeError, "More than one result for #{style}" if db_result.size > 1 db_result.first