aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib/active_resource/base.rb
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-07-21 11:27:23 -0300
committerEmilio Tagua <miloops@gmail.com>2009-07-21 11:27:23 -0300
commitf32c3709830eb8d9f68a59c94f6791621c2b52ac (patch)
treeb34cf0b9321dfd40b795cc761b158be4cbde48f6 /activeresource/lib/active_resource/base.rb
parent9a28bd787660b08aae36155066e61d3608d0b4dd (diff)
parent9d7aae710384fb5f04129c35b86c5ea5fb9d83a9 (diff)
downloadrails-f32c3709830eb8d9f68a59c94f6791621c2b52ac.tar.gz
rails-f32c3709830eb8d9f68a59c94f6791621c2b52ac.tar.bz2
rails-f32c3709830eb8d9f68a59c94f6791621c2b52ac.zip
Merge commit 'rails/master'
Diffstat (limited to 'activeresource/lib/active_resource/base.rb')
-rw-r--r--activeresource/lib/active_resource/base.rb13
1 files changed, 3 insertions, 10 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index 88a431a6d9..bc82139dac 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -804,8 +804,7 @@ module ActiveResource
# my_company.size = 10
# my_company.save # sends PUT /companies/1 (update)
def save
- notify(:before_save)
- (new? ? create : update).tap { notify(:after_save) }
+ new? ? create : update
end
# Deletes the resource from the remote service.
@@ -821,8 +820,7 @@ module ActiveResource
# new_person.destroy
# Person.find(new_id) # 404 (Resource Not Found)
def destroy
- notify(:before_destroy)
- connection.delete(element_path, self.class.headers).tap { notify(:after_destroy) }
+ connection.delete(element_path, self.class.headers)
end
# Evaluates to <tt>true</tt> if this resource is not <tt>new?</tt> and is
@@ -997,20 +995,16 @@ module ActiveResource
# Update the resource on the remote service.
def update
- notify(:before_update)
connection.put(element_path(prefix_options), encode, self.class.headers).tap do |response|
load_attributes_from_response(response)
- notify(:after_update)
end
end
# Create (i.e., \save to the remote service) the \new resource.
def create
- notify(:before_create)
connection.post(collection_path, encode, self.class.headers).tap do |response|
self.id = id_from_response(response)
load_attributes_from_response(response)
- notify(:after_create)
end
end
@@ -1093,7 +1087,6 @@ module ActiveResource
class Base
extend ActiveModel::Naming
- include CustomMethods, Validations
- include ActiveModel::Observing
+ include CustomMethods, Observing, Validations
end
end