lib/attachment_magick.rb in attachment_magick-0.2.5 vs lib/attachment_magick.rb in attachment_magick-0.2.6
- old
+ new
@@ -16,13 +16,18 @@
yield(configuration)
end
included do
cattr_accessor :attachment_magick_default_options
-
- embeds_many :images, :class_name => "AttachmentMagick::MongoidImage", :polymorphic => true if self.include?(Mongoid::Document) if defined? Mongoid::Document
- has_many :images, :class_name => "AttachmentMagick::ActiveRecordImage", :as => :imageable, :dependent => :destroy if self.include?(ActiveRecord::Persistence) if defined? ActiveRecord::Persistence
-
+
+ if AttachmentMagick.configuration.orms.include?("Mongoid")
+ embeds_many :images, :class_name => "AttachmentMagick::MongoidImage", :polymorphic => true if self.include?(Mongoid::Document)
+ end
+
+ if AttachmentMagick.configuration.orms.include?("ActiveRecord")
+ has_many :images, :class_name => "AttachmentMagick::ActiveRecordImage", :as => :imageable, :dependent => :destroy if self.include?(ActiveRecord::Persistence)
+ end
+
accepts_nested_attributes_for :images
end
module ClassMethods
def attachment_magick(&block)
\ No newline at end of file