lib/papermill/papermill.rb in papermill-1.3.3 vs lib/papermill/papermill.rb in papermill-1.3.4

- old
+ new

@@ -27,13 +27,12 @@ local_options = args.first || {} (@papermill_associations ||= {}).merge!( assoc_name => Papermill::options.deep_merge(local_options) ) include Papermill::InstanceMethods - before_destroy :destroy_assets after_create :rebase_assets - has_many :papermill_assets, :as => "Assetable", :dependent => :destroy + has_many :papermill_assets, :as => "assetable", :dependent => :destroy [assoc_name, Papermill::options[:base_association_name].to_sym].uniq.each do |assoc| define_method assoc do |*options| scope = PapermillAsset.scoped(:conditions => {:assetable_id => self.id, :assetable_type => self.class.base_class.name}) if assoc != Papermill::options[:base_association_name] @@ -60,13 +59,9 @@ def timestamp @timestamp ||= "-#{(Time.now.to_f * 1000).to_i.to_s[4..-1]}" end private - - def destroy_assets - papermill_assets.each &:destroy - end def rebase_assets PapermillAsset.all(:conditions => { :assetable_id => self.timestamp, :assetable_type => self.class.base_class.name }).each do |asset| asset.created_at < 2.hours.ago ? asset.destroy : asset.update_attribute(:assetable_id, self.id) end