I get it. There is a module that is included in ActionDispatch::Routing::Mapper , and this module supports the #resources method. If #resources was defined directly on ActionDispatch::Routing::Mapper , and not in the module, rewriting it would not work that way (we would have to use the "alias" method).
About modules and classes in general, a module acts as a superclass for the class that included it. By acting as a superclass, I mean that if you have the #foo method defined in the module and you include this module in the class, this class can overwrite the #foo method and call #super , which will call the module method #foo . Example:
module Foo def foo puts "foo" end end class Bar include Foo def foo super puts "bar" end end Bar.new.foo
source share