Re: ActiveResource::create with an existing id: Rails 3.0 vs Rails 3.1 and above

11 views
Skip to first unread message

Chuck Han

unread,
Dec 19, 2012, 6:09:27 PM12/19/12
to rubyonra...@googlegroups.com
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).

On Tuesday, December 18, 2012 2:52:18 PM UTC-8, Chuck Han wrote:
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
Reply all
Reply to author
Forward
0 new messages