Merged r11760 from trunk (#13850).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.3-stable@11837 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-05-12 09:45:52 +00:00
parent 2c408ca6a5
commit af632568e3
3 changed files with 36 additions and 1 deletions
+11
View File
@@ -148,4 +148,15 @@ module ObjectHelpers
attachment.save!
attachment
end
def CustomField.generate!(attributes={})
@generated_custom_field_name ||= 'Custom field 0'
@generated_custom_field_name.succ!
field = new(attributes)
field.name = @generated_custom_field_name.dup if field.name.blank?
field.field_format = 'string' if field.field_format.blank?
yield field if block_given?
field.save!
field
end
end