drapergem / draper

Decorators/View-Models for Rails Applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

already initialized constant in view helper modules

blarralde opened this issue · comments

Rails 6.0.0
Draper 3.1.0

Steps to reproduce:

  • in a view helper (under app/helpers) add a constant like MY_CONSTANT = 'const'
  • restart the rails server

Buggy behavior:

/app/helpers/test_helper.rb:2: warning: already initialized constant TestHelper::MY_CONSTANT
app/helpers/test_helper.rb:2: warning: previous definition of MY_CONSTANT was here

This seems to be due to draper loading all the helpers so it can use the h method, and then zeitwerk autoloading everything again (or the other way, I'm not sure).