Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ Metrics/BlockLength:

Metrics/MethodLength:
Max: 40

Metrics/AbcSize:
Max: 50
5 changes: 3 additions & 2 deletions app/controllers/messages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def index
# %> and <-> are defined by pg_trgm.
# https://www.postgresql.org/docs/17/pgtrgm.html
message_where = if Rails.env.production?
Message.where('body %> ? AND list_id IN (?) ORDER BY body <-> ?', query, list_ids, query)
Message.where('body %> ? AND list_id IN (?)', query, list_ids)
.order(Arel.sql('body <-> ?', query))
else
Message.where('body LIKE ? AND list_id IN (?)', "%#{query}%", list_ids)
end
Expand All @@ -36,7 +37,7 @@ def show
def get_list_ids(params)
list_ids = []
['ruby-talk', 'ruby-core', 'ruby-list', 'ruby-dev'].each do |name|
if params[name.tr('-', '_').to_sym] == '1'
if params[name.tr('-', '_').to_sym] != '0'
list_ids << List.find_by_name(name).id
end
end
Expand Down