Closed Spone closed 6 years ago
You're really not calling your helper with a block, so it's normal block_given?
returns false
.
We could add a new method that returns what you want though. We would just have to
component
helper (like here),ComponentHelper
(for example block_given_to_component?
).Yes, it's the normal behavior. Nonetheless, it would be a good idea to be able to check if the component has been called with a block.
block_given_to_component?
sounds like a good name.
When calling
block_given?
from a method in a component module, it returnsfalse
, even if the component is called with a block.If I call
block_given?
from the partial, it works as expected.Is there a way to improve this?
Module:
Partial:
Rendering the component with a block: