Forum: Ruby on Rails Verification: Module methods being called from controller

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2006-03-21 19:54
If I call module methods from a controller by "requiring my module into"
my controller (note that I am not doing a mixin), then it appears that I
have to define the module methods as class methods, e.g.

def self.xyz

in order to access them via the module name.

Why is this necessary if a module isn't a class?

It's a little confusing because in the Pickaxe book, it looks like you
can just define module methods with

def xyz

and then access them via ModuleName.xyz.

Is Rails adding a restriction here or am I misunderstanding something
fundamental?

Thanks,
Wes
This topic is locked and can not be replied to.