fix issue #385
This commit is contained in:
parent
f42fb1afe1
commit
e225ad2278
@ -27,7 +27,7 @@ module Locomotive
|
||||
|
||||
def set_label_field
|
||||
if @new_label_field_name.present?
|
||||
self.label_field_id = self.entries_custom_fields.detect { |f| f.name == @new_label_field_name.underscore }._id
|
||||
self.label_field_id = self.entries_custom_fields.detect { |f| f.name == @new_label_field_name.underscore }.try(:_id)
|
||||
end
|
||||
|
||||
# unknown label_field_name, get the first one instead
|
||||
|
@ -284,6 +284,13 @@ describe Locomotive::ContentType do
|
||||
lambda { asset.active_at }.should raise_error
|
||||
end
|
||||
|
||||
it 'removes the field used as the label when setting the original label_field_name value before' do
|
||||
@content_type.label_field_name = 'name'
|
||||
@content_type.entries_custom_fields.destroy_all :conditions => { :name => @content_type.label_field_name }
|
||||
@content_type.save
|
||||
@content_type.label_field_name.should == 'description'
|
||||
end
|
||||
|
||||
it 'renames field label' do
|
||||
@content_type.entries_custom_fields[1].label = 'Simple description'
|
||||
@content_type.entries_custom_fields[1].name = nil
|
||||
|
Loading…
Reference in New Issue
Block a user