On Sep 4, 2:25 pm, Alpha Blue <[email protected]>
wrote:
>
> When no data is found, the values for those constants are created for
> each model's current week. The issue I'm having is when trying to use
> the same constant to update data on top of the current week if data
> already exists. I thought I would be able to use save or save! but
> those methods won't exist with the current way I'm processing the data.
>
> If anyone can help me with the last part of the method after (else)
> where I'm trying to update the data, I'd appreciate it.
>
update expects either an id and a hash of attributes, or a hash of ids
to attributes, ie
update(1, {:name => 'bob'})
update the row with id 1 and sets the name to bob.
the other form assumes you are passing an array of ids, and an array
of hashes, so
update([1,2], [{:name => 'bob'}, {:name => 'alice'}])
update the row with id 1 and sets the name to bob and updates the row
with id 2 and sets the name to alice
Fred
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---