Re: Update model with array of IDs

Valery Kvon
Tue, 21 Feb 2012 19:00:19 -0000

On 21.02.2012, at 19:25, Rajarshi Chakravarty wrote:

> Hi,
> I am trying to use the update method of activerecord with an array of
> ids as the first param.
> It does not update any row. The APIs say that it should work.
>
> The array contains 2 IDs.
> RSCampaign.update([1,2], {:end_date =>
> Date.strptime("120228","%y%m%d")})
>
> If I put an ID instead of the array, it updates fine.

API says that exactly:
RSCampaign.update([1,2], {:end_date
=>[Date.strptime("120228","%y%m%d")}]*2)