I have come across a problem when I am trying to extend ApplicationController with a .rb file containing a module inside /lib folder.
The problem is, let's say if I want to add a method called authenticate inside ApplicationController using ApplicationController.send(:include), I would do it as:
extension.rb module Extension module ClassMethods ... end def self.included(base) base.extend(Extension.ClassMethods) end end
ApplicationController.send(:include, Extension)
This would work only if I put the require statement at the end of application.rb, I want to know if there is any chance it would work too if I want to put the require statement at the top?