Project

General

Profile

Update CustomField's value in class issue

Added by You Ri over 10 years ago

Hello, :)

I try to modify the value of a customfield when use after_create.

I have this code :

 def default_assignDev
    puts 'dev'
    if dev.nil?
     devfieldCustom = CustomField.where("name = 'Développeur'").first.custom_values.where("customized_id = ?", self.id).first      
     devfieldCustom.update_attribute(:value, 
                            CustomField.where("name = 'Développeur par défaut'").first.custom_values.where("customized_id = ?", self.project.id).first.value)

    end
  end

I have not error message, the value is update in object but the database are not updated.
So how, update value of custom field in issue (or other) class.

Thanks