Closed joemasilotti closed 1 year ago
Turns out you need to allow the Rails helpers before including the Bridgetown helpers.
This works:
class SiteComponent < ViewComponent::Base
Bridgetown::ViewComponentHelpers.allow_rails_helpers :tag
include Bridgetown::ViewComponentHelpers
end
This does not work:
class SiteComponent < ViewComponent::Base
include Bridgetown::ViewComponentHelpers
Bridgetown::ViewComponentHelpers.allow_rails_helpers :tag
end
@joemasilotti Ah, that makes sense. Maybe there's a way we can document this better or otherwise make it more obvious how it works?
Done! #687.
When using Rails helpers the
:tag
option only works when the server automatically reloads. But not on first launch.Bridgetown Version:
bridgetown 1.1.0 "Belmont"
To Reproduce
:tag
helper from Railstag
helper in a componentCurrent behavior If starting the app cold it crashes with the error produced below.
Note that if the
tag
helper is not used, then the server is started, then thetag
helper is used it works as expected.Expected behavior The
tag
helper should not raise an error.Computing environment (please complete the following information):
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin21]
Additional context