Props misinterpreted on ruby < 3
Because Ruby < 3 may misinterpreting keyword arguments, the key _props is introduced:
def svelte_component(path, props = {}, html: {}, options: {}, _props: {})
This means, on Ruby < e, passing a hash as first argument
svelte_component('views/contacts/people/companyLocationInputs', {key: "value"})
may raise: «unknown keyowrd: key». For that, the _props key is introduced:
svelte_component('views/contacts/people/companyLocationInputs', _props: {key: "value"})
will fix this.
But, for ruby >= 3 this will raise a error because this is only a interim.
UPDATE 6.8.2025 / svelte-on-rails version-8
The _props keyword-argument is removed and the methods svelte_component_ruby2 and cached_svelte_component_ruby2 are introduced for older rubies. See release 8.0.0
Edited by Christian Sedlmair