Commit 76c4e831932bff2273c38abe1ff37cdb79164c90

Authored by Valeriy Sizov
1 parent 810d0903

Minore code-style fixes

app/models/group.rb
@@ -23,7 +23,7 @@ class Group < ActiveRecord::Base @@ -23,7 +23,7 @@ class Group < ActiveRecord::Base
23 delegate :name, to: :owner, allow_nil: true, prefix: true 23 delegate :name, to: :owner, allow_nil: true, prefix: true
24 24
25 def self.search query 25 def self.search query
26 - where("name like :query OR code like :query", query: "%#{query}%") 26 + where("name LIKE :query OR code LIKE :query", query: "%#{query}%")
27 end 27 end
28 28
29 def to_param 29 def to_param
app/models/project.rb
@@ -38,7 +38,7 @@ class Project < ActiveRecord::Base @@ -38,7 +38,7 @@ class Project < ActiveRecord::Base
38 end 38 end
39 39
40 def self.search query 40 def self.search query
41 - where("name like :query OR code like :query OR path like :query", query: "%#{query}%") 41 + where("name LIKE :query OR code LIKE :query OR path LIKE :query", query: "%#{query}%")
42 end 42 end
43 43
44 def self.create_by_user(params, user) 44 def self.create_by_user(params, user)
@@ -127,7 +127,7 @@ class Project < ActiveRecord::Base @@ -127,7 +127,7 @@ class Project < ActiveRecord::Base
127 end 127 end
128 128
129 def commit_line_notes(commit) 129 def commit_line_notes(commit)
130 - notes.where(noteable_id: commit.id, noteable_type: "Commit").where("line_code is not null") 130 + notes.where(noteable_id: commit.id, noteable_type: "Commit").where("line_code IS NOT NULL")
131 end 131 end
132 132
133 def public? 133 def public?
app/models/user.rb
@@ -73,7 +73,7 @@ class User < ActiveRecord::Base @@ -73,7 +73,7 @@ class User < ActiveRecord::Base
73 end 73 end
74 74
75 def self.search query 75 def self.search query
76 - where("name like :query or email like :query", query: "%#{query}%") 76 + where("name LIKE :query OR email LIKE :query", query: "%#{query}%")
77 end 77 end
78 end 78 end
79 79
app/roles/issue_commonality.rb
@@ -19,7 +19,7 @@ module IssueCommonality @@ -19,7 +19,7 @@ module IssueCommonality
19 scope :opened, where(closed: false) 19 scope :opened, where(closed: false)
20 scope :closed, where(closed: true) 20 scope :closed, where(closed: true)
21 scope :of_group, ->(group) { where(project_id: group.project_ids) } 21 scope :of_group, ->(group) { where(project_id: group.project_ids) }
22 - scope :assigned, lambda { |u| where(assignee_id: u.id)} 22 + scope :assigned, ->(u) { where(assignee_id: u.id)}
23 23
24 delegate :name, 24 delegate :name,
25 :email, 25 :email,