Marnen Laibow-Koser wrote:
> Patrick Clas wrote:
> [...]
>> Well the task isn't as simple as it seems.  I have it working fine now 
>> with SQL, rails just seems to be lacking a bit in this area.  
> 
> So try ar-extensions or something.
> 
>> Of course 
>> I realize they have to be since they are supporting more than just 
>> mysql.
> 
> Irrelevant.  Any SQL database can do bulk updates.
> 
> What exactly are you trying to do that you can't do through Rails?
> 
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> [email protected]

Any SQL database can do bulk updates, but mysql makes it easier by 
allowing table joins during updates.  I suppose I could try to redesign 
my statement, but I don't see the need since I own the server I'm 
running on and mysql is always going to be there.  I guess I'm not a 
rails purist so I don't have any strong objection to putting SQL in my 
code.  Here is the statement I now have in my code:

UPDATE users, game_collections SET users.points = users.points + 
#{point_diff},
    users.adjusted_points = users.points * 
users.complete/(users.complete + users.incomplete) WHERE 
game_collections.user_id = users.id AND game_collections.game_id = 
#{game.id} AND game_collections.percentComplete = 100
-- 
Posted via http://www.ruby-forum.com/.

-- 
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.

Reply via email to