Defect #47 ยป issue.patch
| app/models/issue.rb (working copy) | ||
|---|---|---|
| 35 | 35 |
validates_presence_of :subject, :description, :priority, :tracker, :author, :status |
| 36 | 36 |
validates_inclusion_of :done_ratio, :in => 0..100 |
| 37 | 37 |
validates_associated :custom_values, :on => :update |
| 38 |
validates_uniqueness_of :subject |
|
| 38 | 39 | |
| 39 | 40 |
# set default status for new issues |
| 40 | 41 |
def before_validation |
| ... | ... | |
| 68 | 69 |
custom_values.each {|c|
|
| 69 | 70 |
@current_journal.details << JournalDetail.new(:property => 'cf', |
| 70 | 71 |
:prop_key => c.custom_field_id, |
| 71 |
:old_value => @custom_values_before_change[c.custom_field_id],
|
|
| 72 |
:value => c.value) unless @custom_values_before_change[c.custom_field_id]==c.value
|
|
| 72 |
: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]),
|
|
| 73 |
: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? )
|
|
| 73 | 74 |
} |
| 74 | 75 |
@current_journal.save unless @current_journal.details.empty? and @current_journal.notes.empty? |
| 75 | 76 |
end |