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”) {
}, options.delete(“unit”) { “£” }, options.delete(“separator”) { “.” },
options.delete(“delimiter”) { “,” }
separator = “” unless precision > 0
parts = number_with_precision(number, precision).split(’.’)
unit + number_with_delimiter(parts[0], delimiter) + separator +

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 => “£”})

This doesnt work either it is not picking up the &pound how can i solve
this problem thanks

this works for me…

<%= number_to_currency(12.65, :unit => “£”) %>
returns => £12.65

does that help?

On Dec 6, 6:45 am, Nish P. [email protected]

crap, Google converted it for me. I meant this (take out the
<%= number_to_currency(12.65, :unit => “&remove_pound_remove;”)

hi thanks for that i have tried this and it does work, but what if i was
using active scaffold? how do i get around this as it compeltely ignores

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs