Search code examples
ruby-on-railscontrollerhelper

Rails 6: Controller helper methods still in the /app/helpers folder?


Can I still define helper methods in /app/helpers/<controller_name>/<file_name>.rb or do I have to use Concerns now?

And if I have written a helper-method where-ever the cool place to put them in Rails 6 is now by what command do I now make them available to the view according to the controller action?


Solution

  • In Rails 6 all helpers are included in the controllers by default and accessible through helpers. This changed from previous Rails versions, it used to be each controller included a helper with the same name of the controller by default (and didn't need to access it's method through 'helpers')