Jason Vogel
12/8/2006 6:13:00 PM
Sweet, that works.
Thanks Vincent and Stefano,
Jason
On Dec 8, 12:02 pm, Stefano Crocco <stefano.cro...@alice.it> wrote:
> 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).