Skip to content
Browse files

- tiny refactoring, remove duplication

  • Loading branch information...
1 parent af10377 commit 79c4e021cd18aa381ac44da722a44f3cbb5217db @gramos committed Sep 28, 2010
Showing with 1 addition and 2 deletions.
  1. +1 −2 activeresource/lib/active_resource/associations.rb
View
3 activeresource/lib/active_resource/associations.rb
@@ -44,8 +44,7 @@ def has_one(resource, opts = {})
define_method("#{klass_name}=") do |new_resource|
if send(resource).blank?
new_resource.send("#{h[:association_col]}=", id)
- new_resource.save
- instance_variable_set("@#{resource}", new_resource)
+ instance_variable_set("@#{resource}", new_resource.save)
else
instance_variable_get("@#{resource}").send(:update_attribute, h[:association_col], id)
end

0 comments on commit 79c4e02

Please sign in to comment.
Something went wrong with that request. Please try again.