Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "save(false)" do?

In the following code, what does save(false) do?

def create_reset_code!  
    @reset = true  
    self.attributes = {:reset_code => Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )}  
    save(false)  
  end  

If it's for updating the credentials, then why do they include false?

like image 802
shajin Avatar asked Feb 26 '11 12:02

shajin


1 Answers

save(false) bypasses validations for the model object being saved.

like image 64
Mörre Avatar answered Oct 12 '22 02:10

Mörre