Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7308 (reopened enhancement)

Opened 3 years ago

Last modified 2 years ago

+1 [PATCH] Add ActiveResource.update_attribute(s)

Reported by: rwdaigle Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveResource Version: edge
Severity: normal Keywords:
Cc:

Description

Adds update_attribute and update_attributes in honor of ActiveRecord to provide an easy update and save of attributes:

Person.find(:first).update_attribute("name", "David")  # => true
Person.find(:first).update_attributes("name" => "David", "last" => "Last")  # => true

Attachments

activeresource_update_attributes_patch.diff (4.5 kB) - added by rwdaigle on 01/23/07 01:48:33.
Adds update_attribute(s) to ActiveRecord::Base
reworked_activeresource_update_attributes_patch.diff (4.5 kB) - added by EmmanuelOga on 01/17/08 15:19:17.
Same patch as before but reworked because the patch utility can't find the context of the changes (I'm sure this is happening because the patch was created months ago)

Change History

01/23/07 01:48:33 changed by rwdaigle

  • attachment activeresource_update_attributes_patch.diff added.

Adds update_attribute(s) to ActiveRecord::Base

03/14/07 22:13:13 changed by josh

  • keywords set to verified.

07/20/07 01:19:47 changed by mpalmer

  • keywords deleted.
  • status changed from new to closed.
  • resolution set to worksforme.

According to activeresource/README in edge, these methods are already supported. My guess is that someone else had the same good idea and it's been implemented. Please check edge and, if the feature isn't to your liking, reopen this ticket or submit a new one. Thanks.

10/07/07 15:01:37 changed by patcito

  • status changed from closed to reopened.
  • resolution deleted.

I don't see anything in activeresource/README that says update_attributes is supported and from my test application I get an error when I try to update my ARes (rev 7774) object:

NoMethodError: undefined method `update_attributes'

So I reopen the bug, maybe I missed something though and update_attributes is supported, feel free to close it then :)

01/17/08 15:16:51 changed by EmmanuelOga

+1 for this patch. It improves the usage of an ActiveResource in places where you previously had an ActiveRecord.

P.S: I had to manually tweak the patch to be able to apply it on rev. 8650.

01/17/08 15:19:17 changed by EmmanuelOga

  • attachment reworked_activeresource_update_attributes_patch.diff added.

Same patch as before but reworked because the patch utility can't find the context of the changes (I'm sure this is happening because the patch was created months ago)

01/17/08 15:38:10 changed by EmmanuelOga

  • summary changed from [PATCH] Add ActiveResource.update_attribute(s) to +1 [PATCH] Add ActiveResource.update_attribute(s).

Mmm I forgot to change the summary, sorry, my first interaction with the rails trac