From f6bd9a4dfaba4e03e1879beea2d52fd877086ff2 Mon Sep 17 00:00:00 2001 From: fauno Date: Mon, 22 Jun 2020 16:03:19 -0300 Subject: [PATCH] Filtrar correctamente --- app/jobs/telegram_job.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/jobs/telegram_job.rb b/app/jobs/telegram_job.rb index 8a6304b..d3e9bbc 100644 --- a/app/jobs/telegram_job.rb +++ b/app/jobs/telegram_job.rb @@ -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: "#{payload['subject']}\n\n#{payload['message']}" + parse_mode: 'HTML', + text: "#{payload['subject']}\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