Added a setter method for label_field_id in content_types.rb model. Should resolve issue where label_field_name was not being updated properly through the UI. Fix for issue #398.

This commit is contained in:
waynegerard 2012-05-19 13:51:41 -07:00
parent 7e0fcb62ee
commit be26ae3059

View File

@ -84,6 +84,13 @@ module Locomotive
self.class.class_name_to_content_type(class_name, self.site)
end
def label_field_id=(value)
# update the label_field_name if the label_field_id is changed
new_label_field_name = self.entries_custom_fields.find(value).name rescue nil
self.label_field_name = new_label_field_name
super(value)
end
def label_field_name=(value)
# mandatory if we allow the API to set the label field name without an id of the field
@new_label_field_name = value unless value.blank?