Simple search implementation

This commit is contained in:
Dmitriy Zaporozhets 2012-03-16 01:14:39 +02:00
parent b2c13bdd77
commit 5d2bd5ec3a
13 changed files with 127 additions and 4 deletions

View file

@ -37,6 +37,10 @@ class MergeRequest < ActiveRecord::Base
scope :closed, where(:closed => true)
scope :assigned, lambda { |u| where(:assignee_id => u.id)}
def self.search query
where("title like :query", :query => "%#{query}%")
end
def validate_branches
if target_branch == source_branch
errors.add :base, "You can not use same branch for source and target branches"