【发布时间】:2021-06-21 17:47:16
【问题描述】:
我正在努力弥补一些东西,就是当推送通知到达设备时,如果用户定义的标题末尾有空格,则该空格出现在推送通知中。它看起来很丑陋,我一直在努力得到它。我知道我可以用 rstrip 做到这一点,但不知道如何或在哪里。有人可以帮我吗?干杯!
这是其中一种方法:
def self.sell_alert(user, amount, poi_picture)
return if user.device_token.nil?
create_params = {
date: DateTime.now,
title: "Your content has been sold!",
message: "\"#{poi_picture.title #Here lies the problem#}\" was sold for $#{sprintf('%.2f',amount)} and your account has been credited. Cheers!",
poi_picture_id: poi_picture.id,
notification_type: :payment
}
create_and_send_notification(create_params, user.id, SellAlertWorker)
end
【问题讨论】:
标签: ruby-on-rails json ruby api backend