Index: app/models/issue.rb =================================================================== --- app/models/issue.rb (revision 448) +++ app/models/issue.rb (working copy) @@ -35,6 +35,7 @@ validates_presence_of :subject, :description, :priority, :tracker, :author, :status validates_inclusion_of :done_ratio, :in => 0..100 validates_associated :custom_values, :on => :update + validates_uniqueness_of :subject # set default status for new issues def before_validation @@ -68,8 +69,8 @@ custom_values.each {|c| @current_journal.details << JournalDetail.new(:property => 'cf', :prop_key => c.custom_field_id, - :old_value => @custom_values_before_change[c.custom_field_id], - :value => c.value) unless @custom_values_before_change[c.custom_field_id]==c.value + :old_value => (@custom_values_before_change[c.custom_field_id].length > 250 ? @custom_values_before_change[c.custom_field_id].slice(0..250) + "..." : @custom_values_before_change[c.custom_field_id]), + :value => (c.value.length > 250 ? c.value.slice(0..250) + "..." : c.value)) unless (@custom_values_before_change[c.custom_field_id]==c.value || @custom_values_before_change[c.custom_field_id].nil? || c.value.nil? ) } @current_journal.save unless @current_journal.details.empty? and @current_journal.notes.empty? end