如何在Ruby on Rails中使用Firebase? [英] How to use Firebase with Ruby on Rails?
本文介绍了如何在Ruby on Rails中使用Firebase?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我看过不同的红宝石,例如 firebase-ruby 和 rest-firebase ,但宝石没有与rails很好地集成.
I've looked at different ruby gems like firebase-ruby and rest-firebase, but the gems don't integrate well with rails.
我的问题是,有没有更简单的方法将ApplicationRecord设计模式与Firebase用作后端?
My question is, is there an easier way of using the ApplicationRecord design pattern with Firebase as my backend?
推荐答案
首先,您需要获得两件事
Firstly you need to get two things
- FIREBASE_SERVER_API_KEY
- FIREBASE_NOTIFICATION_URL .
- FIREBASE_SERVER_API_KEY
- FIREBASE_NOTIFICATION_URL.
之后,只需在标题中传递这些内容
After that just pass these in headers
{"Authorization" => "key=#{FIREBASE_SERVER_API_KEY}", "Content-Type" => "application/json"}
然后通过这些
{"registration_ids":
["pass-device-token"],
"priority":"high",
"data":{}}
这篇关于如何在Ruby on Rails中使用Firebase?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文