Sha256: 2380f9636ba39c192d2d56e5e375be47e5b5869d86e87a8db2f175a0b505ee05
Contents?: true
Size: 1.06 KB
Versions: 12
Compression:
Stored size: 1.06 KB
Contents
module Saviour module Model def self.included(klass) Integrator.new(klass, PersistenceLayer).setup! klass.class_eval do raise(NoActiveRecordDetected, "Error: ActiveRecord not detected in #{self}") unless self.ancestors.include?(ActiveRecord::Base) after_destroy { Saviour::LifeCycle.new(self, PersistenceLayer).delete! } after_update { Saviour::LifeCycle.new(self, PersistenceLayer).update! } after_create { Saviour::LifeCycle.new(self, PersistenceLayer).create! } validate { Saviour::Validator.new(self).validate! } end end def reload(*args) self.class.attached_files.each do |attach_as| instance_variable_set("@__uploader_#{attach_as}", nil) end super end def dup duped = super self.class.attached_files.each do |attach_as| duped[attach_as] = nil duped.instance_variable_set("@__uploader_#{attach_as}", send(attach_as).dup(duped)) duped.instance_variable_set("@__uploader_#{attach_as}_was", nil) end duped end end end
Version data entries
12 entries across 12 versions & 1 rubygems