Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/AvocadoHQ/avocado
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianthedev committed Jun 10, 2020
2 parents 8484af6 + e963b91 commit 2305a99
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/avocado/app/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def query_search(query: '', via_resource_name: , via_resource_id:)
db_query = related_model.find(via_resource_id).public_send(self.resource_name_plural.downcase)
end

self.search.each_with_index do |search_by, index|
[self.search].flatten.each_with_index do |search_by, index|
query_string = "text(#{search_by}) ILIKE '%#{query}%'"

if index == 0
Expand All @@ -195,7 +195,7 @@ def query_search(query: '', via_resource_name: , via_resource_id:)
end
end

db_query
db_query.select("#{:id}, #{title} as \"name\"")
end

def model
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/app/services/avocado/resources/team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Resources
class Team < Resource
def initialize
@title = :name
@search = :id
@search = [:id, :name]
end

fields do
Expand Down

0 comments on commit 2305a99

Please sign in to comment.