I am using the number to currency function because i live in the uk and
the company want me to only show values of the pound of course.I have
created all my application using ruby script/generate
scaffold_resource… I have come across with a problem… this code is
in my applcation:
def number_to_currency(number, options = {})
options = options.stringify_keys
precision, unit, separator, delimiter = options.delete(“precision”) {
2
}, options.delete(“unit”) { “£” }, options.delete(“separator”) { “.” },
options.delete(“delimiter”) { “,” }
separator = “” unless precision > 0
begin
parts = number_with_precision(number, precision).split(’.’)
unit + number_with_delimiter(parts[0], delimiter) + separator +
parts[1].to_s
rescue
number
end
end
it definately should work, but why doesnt the £ sign come as a question
mark I have also tryed:
def number_to_currency_gbp (number)
number_to_currency(number, { :unit => “£”})
end
This doesnt work either it is not picking up the £ how can i solve
this problem thanks