Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add before/after create callbacks

add before_create/after_create callbacks.
Warning: Not well tested!
  • Loading branch information...
commit 0dfae96b550f077c28ad51f1420628af1ba66500 1 parent 7ab4c94
taryneast authored
Showing with 2 additions and 0 deletions.
  1. +2 −0  lib/hyperactive_resource.rb
View
2  lib/hyperactive_resource.rb
@@ -549,11 +549,13 @@ def update
# Create (i.e. save to the remote service) the new resource.
def create
return false unless self.valid?
+ run_callbacks(:before_create)
connection.post(collection_path, encode, self.class.headers).tap do |response|
save_nested
load_attributes_from_response(response)
merge_saved_nested_resources_into_attributes
end
+ run_callbacks(:after_create)
self
end
Please sign in to comment.
Something went wrong with that request. Please try again.