兩個JS controller 溝通/隨機產生12位數亂碼

金流處理方式

幕前

即時付款(信用卡)

幕後處理

非同步處理,沒有馬上付錢(匯款)

ngork 套件

可以產生「暫時的網址」

dotenv 套件

處理環境變數 或 機要資訊(金鑰)

處理兩個JS controller 溝通

參考這裡fullstackheroes

1
2
const event = new CustomEvent("update-map");
window.dispatchEvent(event);
1
data-action="update-map@window->map#updateHotspotLocation"

隨機產生12位數亂碼

1
2
3
4
5
6
7
before_validation :generate_serial

private

def generate_serial
self.serial = SecureRandom.alphanumeric(12)
end