From ee5ef67c443407f616feef3a8cade8ba3a9d6ef0 Mon Sep 17 00:00:00 2001 From: Jacques Crocker Date: Sat, 18 Sep 2010 20:21:03 -0700 Subject: Allow ActiveResource to work with non-generated ids [#5660 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit updates new? so that it knows whether or not the record was actually new or not, and doesn't rely solely on the presence of id. This enables the ability to set a custom primary_key that is not autogenerated by the server. Signed-off-by: José Valim --- activeresource/test/cases/base/custom_methods_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activeresource/test/cases/base') diff --git a/activeresource/test/cases/base/custom_methods_test.rb b/activeresource/test/cases/base/custom_methods_test.rb index 459d33c24f..0fbf94bc0e 100644 --- a/activeresource/test/cases/base/custom_methods_test.rb +++ b/activeresource/test/cases/base/custom_methods_test.rb @@ -91,7 +91,7 @@ class CustomMethodsTest < Test::Unit::TestCase 201, {'Location' => '/people/1/addresses/2.xml'}), addy.post(:link) - matz = Person.new(:id => 1, :name => 'Matz') + matz = Person.find(1) assert_equal ActiveResource::Response.new(@matz, 201), matz.post(:register) end -- cgit v1.2.3