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/ number_helper.rb

and i didn't modify the file under config dir except database.yml. Isn't actionpack included in rails projects by default? how can i get number_with_delimiter() work?

Thanks in advance.

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:

Where are you calling it from ?

Fred

Fred: Thanks for your reply, i call it from my controller, like this: class Visitor::UserAgentStatsController < ApplicationController   def index     VisitorUserAgentStats.find(:all)     number_with_delimiter(record.user_agent)     respond_to do |format|       format.html # index.html.erb       format.xml { render :xml => @graph}     end   end

I wonder how can i make number_with_delimtier availabe to my code? while i am using ApplicationController without any require or inlucde directive...

sorry, the source code should be like this: class Visitor::UserAgentStatsController < ApplicationController   def index     @graph = Array.new     @stats = VisitorUserAgentStats.find(:all)     @stats.each do |record|         @graph.push(number_with_delimiter(record.user_agent))     end     respond_to do |format|       format.html # index.html.erb       format.xml { render :xml => @graph}     end   end

I wonder how can i make number_with_delimtier availabe to my code? while i am using ApplicationController without any require or inlucde directive...

helpers are available to views only (hence the name view helpers) (at least not unless you start playing some games which you seem to say you don't want to do see http://snippets.dzone.com/posts/show/1799 for example)

Fred

Thanks Fred, it is a great help! surely i won't apply that hack, so i just used str.gsub!(/(\d)(?=(\d\d \d)+(?!\d))/, "\\1,")