Displaying 4 results from an estimated 4 matches for "number_helper".
2009 Sep 09
5
Newbie question: undefined method 'number_with_delimiter'(probably configuration problem)
Hi all:
i am using gem to insall rails 2.3.3 and using $rails myapp to
generate my application, but strangely i can''t use the number_helper
below is my env:
export RUBY_HOME=$HOME/ruby
export GEM_HOME=$HOME/gems
export RUBYLIB=$RUBY_HOME/lib:$RUBY_HOME/lib/ruby:$RUBY_HOME/lib/
site_ruby/1.8
export PATH=$HOME/gems/bin:$HOME/ruby/bin:
and:
$ locate number_helper.rb
/home/lobatt/gems/gems/actionpack-2.3.3/lib/action_view/helpers/
n...
2008 Dec 06
0
Problem in number_helper.rb ?
Hello,
Today I noticed that the number_to_currency helper didn''t work anymore
(it just returned the numeric value, without any currency).
I tracked down the error and saw that editing line 89
( number_to_currency method) as follows solved the problem :
Old piece of code :
begin
format.gsub(/%n/, number_with_precision(number,
:precision => precision,
:delimiter =>
2006 Feb 28
4
number_to_currency UK pounds
...currency format I can
use:
number_to_currency(amt, :unit => "?")
but it would be more convenient to set ? as the default currency symbol.
What is the best way to do that?
Should I edit line 39 of this file:
C:\ruby\lib\ruby\gems\1.8\gems\actionpack-1.11.2\lib\action_view\helpers\number_helper.rb
so that options.delete("unit") { "$" } becomes options.delete("unit") {
"?" }
or is there a better way?
Can I set ? as the default at the web application level? An addition to
the \app\helpers within the website files?
I am a newbie to Ruby and Rail....
2006 Jan 24
7
formatting numbers with commas
I needed to format numbers with commas to make it more human
readable. Here''s how I did it.
def commify(number)
c = { :value => "", :length => 0 }
r = number.to_s.reverse.split("").inject(c) do |t, e|
iv, il = t[:value], t[:length]
iv += '','' if il % 3 == 0 && il != 0
{ :value => iv + e, :length =>