我模塊mangopay_helper.rb如何在ruby模塊中連接flash [:notice]?
module MangoPayHelper
def transfer_to_contractor(contract, client, contractor)
amount = contract.amount * 0,1.to_i
begin
MangoPay::Transfer.create({
Tag: "#{contract.id} + #{contract.title}",
AuthorId: client.mangopay_id,
DebitedFunds: {Currency: "EUR", Amount: contract.amount},
Fees: { Currency: 'EUR', Amount: amount},
DebitedWalletId: client.wallet_id,
CreditedWalletId: contractor.wallet_id
})
rescue MangoPay::ResponseError => e
flash[:notice] = " Code: #{ e['Code'] } Message: #{ e['Message'] }"
end
end
end
在控制器的動作我叫MangoPayHelper.transfer_to_contractor
。
Error: undefined local variable or method `flash' for MangoPayHelper:Module
如何在紅寶石模塊中連接閃存?
通閃光燈作爲你爲什麼想從助手修改'flash' transfer_to_contractor' –
但是方法'的論點?這不是好的方法,控制器是使用'flash'玩的正確地方。 –
我從模塊中刪除了閃存,但同樣的錯誤。 – dev85