Skip to content

Commit 043791f

Browse files
committed
Comment to indicate _save may be overridden
1 parent 61d887a commit 043791f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

lib/jsonapi/resource.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,19 @@ def save
117117
end
118118
end
119119

120+
# Override this on a resource to return a different result code. Any
121+
# value other than :completed will result in operations returning
122+
# `:accepted`
123+
#
124+
# For example to return `:accepted` if your model does not immediately
125+
# save resources to the database you could override `_save` as follows:
126+
#
127+
# ```
128+
# def _save
129+
# super
130+
# return :accepted
131+
# end
132+
# ```
120133
def _save
121134
unless @model.valid?
122135
raise JSONAPI::Exceptions::ValidationErrors.new(@model.errors.messages)

0 commit comments

Comments
 (0)