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.



98
99
100
# File 'lib/view_component/errors.rb', line 98

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