Fixed active record callback for assign_code_and_secret method

Runs assign_code_and_secret method before validation