Hotwire Discussion

Modest stimulus_tag_helper gem for the rails


I just pushed POC stimulus_tag_helper gem that I wrote for myself and using it for a while. If anyone is interested to try it and give feedback you are welcome!

Hey! This look like a cool wrapper for Stimulus controllers. Why the use of the double splat when assigning the data attributes?

Sorry for the late response. I did not receive a notification about your message.

In the example"name") will return { data: { "hello-target" => "name"} }, so if you want to add more attributes to your tag, then you have two options:

  1. use merge: text_field_tag("", "","name").merge(class: "input-field"))
  2. or use double splat: text_field_tag("", "", **"name"), class: "input-field")
    IMHO the second variant is prettier.

I think I need to add more examples showing the flexibility of this lib

Thank you for the interest!