I am using Ruby on Rails 3.2.2 and I would like to organize and share custom helper-view methods as-like I made for my view files. That is, in my app/views directory I have a shared folder where I put all shared templates and I would like to have a shared folder (intended to be used the same “sharing way” but for helper files) also in the app/helpers directory.
However, my doubts are:
- Is right to share helper methods instead of putting those in the
ApplicationHelpermodule (even if those helper methods are specific for shared views and not directly related to any model or controller)? - How can I load modules present in the
app/shared/helpersdirectory in order to make those available to views? - Is there some prescriptions to this approach?
In Rails, helpers are actually global. Which means that you can call a user helper in a, say, posts view. So you don’t really have to pollute ApplicationHelper, just divide them in the best way possible, and just use them normally.