lundi 5 décembre 2016

Generating a code failed on afterr_save call back on rails

I am trying to adding a unique value ( Job Code ) inside the table column on my database. I am tying to using the after_save callback on Active Class and update the new value on it.

I am using the following way :

after_save :update_job_code

def update_job_code
   update_column(:job_code, "JOB_" + params[:customer_id])
end

But I could not able to generate a Job code in the format of JOB_<Customer_id>_<Newly Created Job Id>

Let me know how do i generate the job code in relevant format in Active Record after_save call back

Aucun commentaire:

Enregistrer un commentaire