bug suppression image galerie

This commit is contained in:
Nicolas Bally 2011-12-04 21:07:13 +01:00
parent 32c39322ae
commit 937f0389f4
2 changed files with 3 additions and 2 deletions

View File

@ -1,7 +1,8 @@
# -*- encoding : utf-8 -*-
class ImageFile < ActiveRecord::Base
mount_uploader :file, ImageUploader
has_many :gallery_images, :dependent => :destroy
before_save do
if !self.name?
self.name = File.basename(self.file.filename, File.extname(self.file.filename)).to_s if self.file?

View File

@ -1,6 +1,6 @@
# -*- encoding : utf-8 -*-
class GalleryImage < ActiveRecord::Base
belongs_to :image_file, :dependent => :destroy
belongs_to :image_file
belongs_to :gallery
validates :title, :presence => true