Forum: Ruby on Rails ActiveResource::create with an existing id: Rails 3.0 vs Rails 3.1 and above

Posted by Chuck H. (chuck_h)
on 2012-12-19 10:35
(Received via mailing list)
I'm upgrading my application from Rails 3.0 to Rails 3.2 (yeah, I know,
what happened to 3.1?), and I'm experiencing a difference in the REST 
call
when calling ActiveResource::create where the id is already defined.  In
3.0, the app is sending a PUT.  In 3.1 and above, is sending a POST. 
The
PUT seemed to make sense to me since the id already exists.

Is there any documentation of this change?  Am I experiencing something
strange?

Thanks in advance, Chuck
Posted by Chuck H. (chuck_h)
on 2012-12-20 00:10
(Received via mailing list)
Well, when in doubt, check the source code. In 3.0, create checks new?
which looks to see if id.nil? In 3.1 and above, it also checks new?, but
now, new? checks to see if the object has been persisted (which is
different from checking to see if id is defined).
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.