Updating protected attributes using update_all
        Posted  
        
            by Jack
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Jack
        
        
        
        Published on 2010-06-11T00:43:51Z
        Indexed on 
            2010/06/11
            1:02 UTC
        
        
        Read the original article
        Hit count: 318
        
Since you cannot use the normal 'update' and 'update_attribute' methods from ActiveRecord to update a protected attribute, is the following the best way to update an attribute for a single user?
  User.update_all("admin = true","id = 1")
I'm guessing this doesn't lie in the 'best practice' category, so I'm just curious if there is a more appropriate way.
© Stack Overflow or respective owner