Filtrar correctamente

This commit is contained in:
fauno 2020-06-22 16:03:19 -03:00
parent 6b403a71a3
commit f6bd9a4dfa

View file

@ -13,8 +13,8 @@ class TelegramJob < ApplicationJob
piratas.find_each do |pirata|
Telegram.bots[:default].send_message chat_id: pirata.telegram_user,
parse_mode: 'HTML',
text: "<b>#{payload['subject']}</b>\n\n#{payload['message']}"
parse_mode: 'HTML',
text: "<b>#{payload['subject']}</b>\n\n#{payload['message']}"
end
end
@ -23,10 +23,10 @@ class TelegramJob < ApplicationJob
def find_piratas(ids)
piratas = Pirata.where.not(telegram_user: nil)
unless ids == 'all'
if ids == 'all'
piratas
else
piratas.where(id: ids)
end
piratas
end
end