From: Vincent Fourmond Date: 2006-12-09T02:12:18+09:00 Subject: Re: Module issue Jason Vogel wrote: > Disclaimer: Ruby Nuby > > Source > > module Test # (filename my_test.rb) > > def test > puts "\n\ntest fired\n\n" > end > end > > class OfferRenewalController < ApplicationController > > def payment_made > > require 'my_test' > > Test.test > > end > > Error > NoMethodError in Offer renewalController#payment_made > > private method `test' called for Test:Module > > So what am I doing wrong? In the module, you did define test as an instance method. So if you want to use it, you should include Test If you want to use as Test.test, define it as module Test def Test.test [...] or module Test def self.test [...] The latter is better as if you decide to change the name of your module, you won't have to change the names of methods. By the way, I find it funny that you require 'my_test' from within a method. I believe it would be better to write require 'my_test' class OfferRenewalController < ApplicationController def payment_made Test.test end end Cheers, Vince -- Vincent Fourmond, PhD student http://vincent.fourmond.neuf.fr/