Permalink
Browse files

removed deprecation warnings

  • Loading branch information...
1 parent eb3f9b5 commit 9683208a3a65e460fe000702dea06b315edebeb1 Dennis Meise committed Feb 10, 2011
@@ -18,6 +18,7 @@ def self.up
t.integer :gallery_id, :on_delete => :set_null, :references => :digineo_image_galleries
t.integer :image_type_id, :on_delete => :set_null, :references => :digineo_image_types
t.integer :parentmodel_id, :references => nil
+ t.integer :user_id, :references => nil
t.string :parentmodel_type
t.string :file_file_name
t.string :file_content_type
View
@@ -1,9 +1,9 @@
Gem::Specification.new do |s|
s.name = %q{has_images}
- s.version = "0.2.3"
+ s.version = "0.2.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Dennis Meise"]
- s.date = %q{2010-08-30}
+ s.date = %q{2011-02-10}
s.summary = %q{HasImages adds images and galleries to your ActiveRecord models.}
s.homepage = %q{http://github.com/digineo/has_images}
s.email = %q{github@digineo.de}
@@ -7,6 +7,7 @@ class Digineo::Image < ActiveRecord::Base
belongs_to :parentmodel, :polymorphic => true
belongs_to :gallery, :class_name => "Digineo::ImageGallery"
belongs_to :image_type, :class_name => "Digineo::ImageType"
+ belongs_to :user
attr_accessor :file_url
attr_accessor :gallery_name
attr_accessor :image_type_name
View
@@ -12,16 +12,16 @@ def has_images(options={})
# eval is not always evil ;)
# we generate a Digineo::Model::Image clase to store the given paperclip configuration in it
eval <<-EOF
- module Digineo::#{self.class_name}
- class Digineo::#{self.class_name}::Image < Digineo::Image
+ module Digineo::#{self.name}
+ class Digineo::#{self.name}::Image < Digineo::Image
has_attached_file :file, #{options.inspect}
belongs_to :parentmodel, :polymorphic => true, :counter_cache => #{counter_cache.inspect}
end
end
EOF
- has_many :images, :as => :parentmodel, :dependent => :destroy, :order => 'id ASC', :class_name => "Digineo::#{self.class_name}::Image"
- has_one :avatar, :as => :parentmodel, :conditions => 'avatar=1', :class_name => "Digineo::#{self.class_name}::Image"
+ has_many :images, :as => :parentmodel, :dependent => :destroy, :order => 'id ASC', :class_name => "Digineo::#{self.name}::Image"
+ has_one :avatar, :as => :parentmodel, :conditions => 'avatar=1', :class_name => "Digineo::#{self.name}::Image"
has_many :galleries, :as => :parentmodel, :dependent => :destroy, :class_name => 'Digineo::ImageGallery'
named_scope :with_avatar, :include => :avatar

0 comments on commit 9683208

Please sign in to comment.