I was trying to access rails functions (number_with_precision) from an irb session. It can''t find the method. How do I load the libraries ? TIA LS -- Posted via http://www.ruby-forum.com/.
Try this instead: script/console That''s basically what you want. Zed On 2/23/06 12:44 AM, "kevin" <lianseng@hotmail.com> wrote:> I was trying to access rails functions (number_with_precision) from an > irb session. > > It can''t find the method. How do I load the libraries ? > > TIA > LS
Thanks Zed, This is the error I got when I tried that.>> p number_with_precision(1.2334,2)NoMethodError: undefined method `number_with_precision'' for #<Object:0x27891f8> from (irb):1 Do I need to do a ''require'' ? Zed Shaw wrote:> Try this instead: > > script/console > > That''s basically what you want. > > Zed-- Posted via http://www.ruby-forum.com/.
On Thursday, February 23, 2006, at 7:25 AM, kevin wrote:>Thanks Zed, >This is the error I got when I tried that. > >>> p number_with_precision(1.2334,2) >NoMethodError: undefined method `number_with_precision'' for >#<Object:0x27891f8> > from (irb):1 > >Do I need to do a ''require'' ? >Yeah, i believe its in one of the helpers... Mikkel Bruun www.strongside.dk - Football Portal(DK) nflfeed.helenius.org - Football News(DK) ting.minline.dk - Buy Old Stuff!(DK) -- Posted with http://DevLists.com. Sign up and save your time!
kevin wrote:> I was trying to access rails functions (number_with_precision) from an > irb session. > > It can''t find the method. How do I load the libraries ? > > TIA > LSUsing script/console: >ruby script\console Loading development environment. >> include ActionView::Helpers::NumberHelper => Object >> number_with_precision(111.2345) => "111.235" >> Using irb: >irb irb(main):001:0> require ''rubygems'' => false irb(main):002:0> require ''initializer'' => true irb(main):003:0> include ActionView::Helpers::NumberHelper => Object irb(main):004:0> number_with_precision(111.2345) => "111.235" Simo Addsw.it -- Posted via http://www.ruby-forum.com/.
nice Mikkel Bruun www.strongside.dk - Football Portal(DK) nflfeed.helenius.org - Football News(DK) ting.minline.dk - Buy Old Stuff!(DK) -- Posted with http://DevLists.com. Sign up and save your time!
Wow, I tried and gave up - got everything but the "require ''initializer''" Thanks. Simo Gal wrote:> kevin wrote: >> I was trying to access rails functions (number_with_precision) from an >> irb session. >> >> It can''t find the method. How do I load the libraries ? >> >> TIA >> LS > > Using script/console: > >ruby script\console > Loading development environment. > >> include ActionView::Helpers::NumberHelper > => Object > >> number_with_precision(111.2345) > => "111.235" > >> > > Using irb: > >irb > irb(main):001:0> require ''rubygems'' > => false > irb(main):002:0> require ''initializer'' > => true > irb(main):003:0> include ActionView::Helpers::NumberHelper > => Object > irb(main):004:0> number_with_precision(111.2345) > => "111.235" > > > Simo > Addsw.it-- Posted via http://www.ruby-forum.com/.