migrate custom validation

pull/6827/head
Christian Rijke 12 years ago
parent efa994132a
commit fc5d64c8a9
  1. 6
      app/models/impediment.rb

@ -3,6 +3,8 @@ class Impediment < Task
after_save :update_blocks_list
validate :validate_blocks_list
safe_attributes "blocks_ids",
:if => lambda {|impediment, user|
(impediment.new_record? && user.allowed_to?(:create_impediments, impediment.project)) ||
@ -56,10 +58,6 @@ class Impediment < Task
}
end
def validate
validate_blocks_list
end
def validate_blocks_list
if blocks_ids.size == 0
errors.add :blocks_ids, :must_block_at_least_one_issue

Loading…
Cancel
Save