Add Base#reload (closes #12)
Signed-off-by: Marcos Tapajós <tapajos@gmail.com>
This commit is contained in:
parent
73c1b3d47b
commit
2c24702765
2 changed files with 40 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue