Exception: ViewComponent::MissingCollectionArgumentError

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

Constant Summary collapse

MESSAGE =
"The initializer for COMPONENT doesn't accept the parameter `PARAMETER`, " \
"which is required 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) ⇒ MissingCollectionArgumentError

Returns a new instance of MissingCollectionArgumentError.



69
70
71
# File 'lib/view_component/errors.rb', line 69

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