Sha256: cca517f1d36c518d9288106248950b30b7d8470fe70a21487988e4e437487c2d
Contents?: true
Size: 974 Bytes
Versions: 11
Compression:
Stored size: 974 Bytes
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.instance_variable_set("@__uploader_#{attach_as}", send(attach_as).dup) end duped end end end
Version data entries
11 entries across 11 versions & 1 rubygems