Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

:dependent => :destroy für avatar

  • Loading branch information...
commit 7180d805a922b6f575d2985f8dab0b77915b8ecd 1 parent 023e0af
@TeaMoe authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/has_images.rb
View
6 lib/has_images.rb
@@ -23,10 +23,10 @@ def has_images(options={})
has_attached_file :file, options
belongs_to :parentmodel, :polymorphic => true, :counter_cache => counter_cache
})
-
+
belongs_to :parentmodel, :polymorphic => true, :counter_cache => counter_cache
has_many :images, :as => :parentmodel, :dependent => :destroy, :order => 'id ASC', :class_name => "Digineo::Image::#{self.name}"
- has_one :avatar, :as => :parentmodel, :conditions => { :avatar => 1 }, :class_name => "Digineo::Image::#{self.name}"
+ has_one :avatar, :as => :parentmodel, :dependent => :destroy, :conditions => { :avatar => 1 }, :class_name => "Digineo::Image::#{self.name}"
has_many :galleries, :as => :parentmodel, :dependent => :destroy, :class_name => 'Digineo::ImageGallery'
after_create :save_avatar
@@ -40,7 +40,7 @@ def has_images(options={})
alias_method_chain :avatar=, :autobuild
end
-
+
def digineo_image_class
::Digineo::Image.const_get(self.name)
end
Please sign in to comment.
Something went wrong with that request. Please try again.