Fixed active record callback for assign_code_and_secret method