Exception: ViewComponent::EmptyOrInvalidInitializerError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/view_component/errors.rb

Constant Summary collapse

MESSAGE =
"The COMPONENT initializer is empty or invalid. " \
"It must accept the parameter `PARAMETER` to render it as a collection.\n\n" \
"To fix this issue, update the initializer to accept `PARAMETER`.\n\n" \
"See [the collections docs](https://viewcomponent.org/guide/collections.html) for more information on rendering collections."

Instance Method Summary collapse

Constructor Details

#initialize(klass_name, parameter) ⇒ EmptyOrInvalidInitializerError

Returns a new instance of EmptyOrInvalidInitializerError.



57
58
59
# File 'lib/view_component/errors.rb', line 57

def initialize(klass_name, parameter)
  super(MESSAGE.gsub("COMPONENT", klass_name.to_s).gsub("PARAMETER", parameter.to_s))
end