I would like to open a global function for all aspects of my Ruby on Rails project (models, views, and controllers). Initially, I thought I could just add:
def self.my_function
end
in / config / application.rb and then just call:
Application::my_function
anywhere in my application. But that did not work. Thus, I did some search queries, and it looks like I can expose global functions:
- For my controllers in / app / controllers / application _controller.rb
- For my views in / app / helpers / application _helper.rb
- For my models in / lib /
But not for everyone at once.
Can someone tell me if it is possible that I want?
, , , , . include- , .