You really have ever thought that "how i can change $ symbol to my country currency's symbol in production mode?", it has been happened to me. Like we have known that we can not modify Action Pack in Production Server, so the alternative is we have to make a helper to solve problem like this. And this what i do:
- Open appz_name/app/helpers/application_helper.rb
- Then write this code into it:
module ApplicationHelper
def number_to_currency(number, options = {})
options = options.stringify_keys
precision = options["precision"] || 2
unit = options["unit"] || "Rp."
separator = precision > 0 ? options["separator"] || "." : ""
delimiter = options["delimiter"] || ","
begin
parts = number_with_precision(number, precision).split('.')
unit + number_with_delimiter(parts[0], delimiter) + separator + parts[1].to_s
rescue
number
end
end
end
In view you only write like example below:
<%= number_to_currency(@my_money_in_pocket) %>Result:
.
Rp. 50.000,00
.
Another Alternative Without creating Helper is in View you can write like this:
<%= number_to_currency(@my_money_in_pocket, :unit => "Rp. ", :precision => 2, :separator => ",", :delimiter => ".") ) %>
Have Nice Try and Good Luck
3 Response to "How to Create number_to_currency Helper in Production Mode"
BE SMART AND BECOME RICH IN LESS THAN 3DAYS....It all depends on how fast you can be to get the new PROGRAMMED blank ATM card that is capable of hacking into any ATM machine,anywhere in the world. I got to know about this BLANK ATM CARD when I was searching for job online about a month ago..It has really changed my life for good and now I can say I'm rich and I can never be poor again. The least money I get in a day with it is about $2,000.(two thousand USD) Every now and then I keeping pumping money into my account. Though is illegal,there is no risk of being caught ,because it has been programmed in such a way that it is not traceable,it also has a technique that makes it impossible for the CCTVs to detect you..For details on how to get yours today, email the hackers on : (atmmachinehackes @ gmail.com). Tell your loved once too, and start to live large. That's the simple testimony of how my life changed for good...Love you all ...the email address again is atmmachinehackes@gmail.com
Hello everyone am ASHA from USA am using this medium to announce to the world and those in need of financial stability to look no further but contact davidbenjaminltd@outlook.com who helped me with the card in less than 1 week after being scammed of my money by others and yet no card. Are you in need of a loan? Or some sort of financial distress and need saving, SEIZE this opportunity and get rich in no time. There are no hidden charges and they deal on transparency basis. I am forever grateful to DAVID BENJAMIN for changing my life a whole new after being scammed by 2 companies who took advantage of me Contact via email on
davidbenjaminltd@outlook.com 0
Cyberturbo do all kinds of related hacking and cyber works
We give 100% satisfaction and confidential to our clients
We do : * Surveillances
* Hacking of social
media e.g
Facebook, Instagram,
Snapchat
Hangout , emails etc
* Recovery & deleting of
all kinds
of records e.g CCTV
footage,
files evidence
* Upgrade of all kinds
of school
results either high
school,
Colleges, University (
Don't
have to stress
Yourself with much
study)
* Encrypt and decrypt of
all kinds
of documents including
all
multimedia
* Blank cards
* Crypto currency e.g bitcoin
* Bank transfer and western union transfer
We do these and more
Contact us @: Cyberturbosecure@gmail.com
Post a Comment