Add Base#reload (closes #12)

Signed-off-by: Marcos Tapajós <tapajos@gmail.com>
This commit is contained in:
Simone Carletti 2011-02-09 14:31:52 +01:00 committed by Marcos Tapajós
parent 73c1b3d47b
commit 2c24702765
2 changed files with 40 additions and 1 deletions

View file

@ -76,7 +76,17 @@ module CouchRest
save
end
protected
# Reloads the attributes of this object from the database.
# It doesn't override custom instance variables.
#
# Returns self.
def reload
merge!(self.class.get(id))
self
end
protected
def perform_validations(options = {})
perform_validation = case options