Commit d7d59375 authored by Yorick Peterse's avatar Yorick Peterse Committed by Robert Speicher

Removed arel_table receiver from search methods

We can just use "arel_table" in these cases instead of
"SomeClass.arel_table".
parent 0ab9571a
...@@ -59,7 +59,7 @@ module Ci ...@@ -59,7 +59,7 @@ module Ci
# #
# Returns an ActiveRecord::Relation. # Returns an ActiveRecord::Relation.
def self.search(query) def self.search(query)
t = Ci::Runner.arel_table t = arel_table
pattern = "%#{query}%" pattern = "%#{query}%"
where(t[:token].matches(pattern).or(t[:description].matches(pattern))) where(t[:token].matches(pattern).or(t[:description].matches(pattern)))
......
...@@ -41,7 +41,7 @@ class Group < Namespace ...@@ -41,7 +41,7 @@ class Group < Namespace
# #
# Returns an ActiveRecord::Relation. # Returns an ActiveRecord::Relation.
def search(query) def search(query)
table = Group.arel_table table = Namespace.arel_table
pattern = "%#{query}%" pattern = "%#{query}%"
where(table[:name].matches(pattern).or(table[:path].matches(pattern))) where(table[:name].matches(pattern).or(table[:path].matches(pattern)))
......
...@@ -113,7 +113,7 @@ class Note < ActiveRecord::Base ...@@ -113,7 +113,7 @@ class Note < ActiveRecord::Base
# #
# Returns an ActiveRecord::Relation. # Returns an ActiveRecord::Relation.
def search(query) def search(query)
table = Note.arel_table table = arel_table
pattern = "%#{query}%" pattern = "%#{query}%"
where(table[:note].matches(pattern)) where(table[:note].matches(pattern))
......
...@@ -274,7 +274,7 @@ class Project < ActiveRecord::Base ...@@ -274,7 +274,7 @@ class Project < ActiveRecord::Base
# #
# query - The search query as a String. # query - The search query as a String.
def search(query) def search(query)
ptable = Project.arel_table ptable = arel_table
ntable = Namespace.arel_table ntable = Namespace.arel_table
pattern = "%#{query}%" pattern = "%#{query}%"
......
...@@ -121,7 +121,7 @@ class Snippet < ActiveRecord::Base ...@@ -121,7 +121,7 @@ class Snippet < ActiveRecord::Base
# #
# Returns an ActiveRecord::Relation. # Returns an ActiveRecord::Relation.
def search(query) def search(query)
t = Snippet.arel_table t = arel_table
pattern = "%#{query}%" pattern = "%#{query}%"
where(t[:title].matches(pattern).or(t[:file_name].matches(pattern))) where(t[:title].matches(pattern).or(t[:file_name].matches(pattern)))
......
...@@ -294,7 +294,7 @@ class User < ActiveRecord::Base ...@@ -294,7 +294,7 @@ class User < ActiveRecord::Base
# #
# Returns an ActiveRecord::Relation. # Returns an ActiveRecord::Relation.
def search(query) def search(query)
table = User.arel_table table = arel_table
pattern = "%#{query}%" pattern = "%#{query}%"
where( where(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment