aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib/active_resource/base.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-09-04 23:36:13 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-09-04 23:36:13 +0000
commit97487c4e1154696fb0b30ea8727ba5459f575719 (patch)
tree76e6e9d4521f32d995d123995b2e73e884645aae /activeresource/lib/active_resource/base.rb
parent1d4d037b0d74fbc3c1cad1c192a6ea7278aff081 (diff)
downloadrails-97487c4e1154696fb0b30ea8727ba5459f575719.tar.gz
rails-97487c4e1154696fb0b30ea8727ba5459f575719.tar.bz2
rails-97487c4e1154696fb0b30ea8727ba5459f575719.zip
load nil is noop. use new? instead of new_resource?
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5006 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activeresource/lib/active_resource/base.rb')
-rw-r--r--activeresource/lib/active_resource/base.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index ec6cee19fa..40a50201a7 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -102,7 +102,7 @@ module ActiveResource
@prefix_options = prefix_options
end
- def new_resource?
+ def new?
id.nil?
end
@@ -115,7 +115,7 @@ module ActiveResource
end
def save
- new_resource? ? create : update
+ new? ? create : update
end
def destroy
@@ -134,6 +134,7 @@ module ActiveResource
# Manually load attributes from a hash. Recursively loads collections of
# resources.
def load(attributes)
+ return self if attributes.nil?
attributes.each do |key, value|
@attributes[key.to_s] =
case value