Just a note that you should be careful using this method to increment a 
value. It can cause a race condition.

A safer method is to use increment_counter since it updates the value 
directly in the database, not using the current attribute value on the 
instance

CurrentUser.increment_counter(:points_accumulated, params[:id])

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/npSlYyFnUvsJ.
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