Skip to content

Commit 1c4a72e

Browse files
committed
Validate .update method
Follow rails convention by returning false unless the item is valid.
1 parent d6e534c commit 1c4a72e

File tree

1 file changed

+1
-0
lines changed
  • elasticsearch-persistence/lib/elasticsearch/persistence/model

1 file changed

+1
-0
lines changed

elasticsearch-persistence/lib/elasticsearch/persistence/model/store.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def destroy(options={})
9999
# @return [Hash] The Elasticsearch response as a Hash
100100
#
101101
def update(attributes={}, options={})
102+
return false unless valid?
102103
raise DocumentNotPersisted, "Object not persisted: #{self.inspect}" unless persisted?
103104

104105
run_callbacks :update do

0 commit comments

Comments
 (0)