From: Stefano Crocco Date: 2006-12-09T03:02:00+09:00 Subject: Re: Module issue Alle 18:55, venerd� 8 dicembre 2006, Jason Vogel ha scritto: > I plan move the "require" up top, once I've got my stuff straight. > > Okay, I needed the "self." in the Module def. > > < in ahs.rb > > module Ahs > class CreditCard > def self.test2 > puts "\n\nself.CreditCard.test2 fired\n\n" > end > end > def self.test > puts "\n\nself.test fired\n\n" > end > end > > < in offer_renewal_controller.rb > > Ahs.test > Ahs.CreditCard.test2 > > Result: > self.test fired > undefined method `CreditCard' for Ahs:Module [exception thrown] > > What's wrong with the second statement? You should use Ahs::CreditCard, not Ahs.CreditCard. The . syntax is used to call module methods; the :: is used to access constants defined in a module (including classes).