Enabling and Excluding Helpers in Rails

To enable the Rails helper, helper: helper_name and enable all helpers, helper: everything is specified in application_controller.

Now, how do I enable the N-1 available helpers? In other words, how to exclude very few helpers?

+3
source share
1 answer

It seems to me that you need to write your own method (for example all_helpers) to get characters ( :foo) or module names ( FooHelper) for all your helpers (perhaps through file system calls to app/helpers), and then allow the exception list to be passed to the method. Then call it something like:

helper all_helpers(:exclude => :bar)

Rails 'ActionController::Helpers#all_application_helpers , .

+3

Source: https://habr.com/ru/post/1723225/


All Articles