Refactoring: Agora o sistema se comporta bem com objetos excluidos
This commit is contained in:
@@ -279,6 +279,10 @@ module ActiveRecord #:nodoc:
|
||||
end
|
||||
end
|
||||
|
||||
def previous_version(current_version = self.version)
|
||||
self.versions.find(:first, :conditions => [ 'version < ?', current_version ], :order => 'version desc')
|
||||
end
|
||||
|
||||
protected
|
||||
# sets the new version before saving, unless you're using optimistic locking. In that case, let it take care of the version.
|
||||
def set_new_version
|
||||
@@ -394,4 +398,4 @@ module ActiveRecord #:nodoc:
|
||||
end
|
||||
end
|
||||
|
||||
ActiveRecord::Base.class_eval { include ActiveRecord::Acts::Versioned }
|
||||
ActiveRecord::Base.class_eval { include ActiveRecord::Acts::Versioned }
|
||||
|
||||
Reference in New Issue
Block a user