Auto-merge: checking via AJAX

This commit is contained in:
Valery Sizov 2012-04-16 22:08:03 +03:00
parent f145450415
commit 8269a3a735
6 changed files with 43 additions and 10 deletions

View file

@ -49,6 +49,15 @@ class MergeRequest < ActiveRecord::Base
where("source_branch like :branch or target_branch like :branch", :branch => branch_name)
end
def human_state
states = {
CAN_BE_MERGED => "can_be_merged",
CANNOT_BE_MERGED => "cannot_be_merged",
UNCHECKED => "unchecked"
}
states[self.state]
end
def validate_branches
if target_branch == source_branch
errors.add :base, "You can not use same branch for source and target branches"