Exception: ViewComponent::ContentSlotNameError

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

Constant Summary collapse

MESSAGE =
"COMPONENT declares a slot named content, which is a reserved word in ViewComponent.\n\n" \
"Content passed to a ViewComponent as a block is captured and assigned to the `content` accessor without having to create an explicit slot.\n\n" \
"To fix this issue, either use the `content` accessor directly or choose a different slot name."

Instance Method Summary collapse

Constructor Details

#initialize(klass_name) ⇒ ContentSlotNameError

Returns a new instance of ContentSlotNameError.



96
97
98
# File 'lib/view_component/errors.rb', line 96

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