0
我想一個數字格式無論是貨幣還是軌助手裏小數點後2位(APP /傭工/ emails_helper.rb)如何格式化數字2位小數在軌幫手
module EmailsHelper
def email_message(invoice)
message = "PO: #{invoice.po_number}\nAmount: #{number_to_currency(invoice.total)}"
return message
end
end
當我試試這個,我得到了以下錯誤:
undefined method `number_to_currency' for #<EmailsController:0x00000102b88640>
我假設這是因爲該文件是RB而不是ERB但不知道如何處理。
在打印過程中不會'%0.2f'工作? – uday