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

Loading…
Cancel
Save