I'd like to use Rails' link_to helper to represent a link written in htm like this, but it doesn't work with a Syntax Error.
I get an Error in the code below.

link_to ("Shop", "javascript: void (0)", {class: "dropdown-toggle", data: {toggle: "dropdown", hover: "dropdown", delay: "300", close-others: " true "}, aria-expanded:" false "})

I read a few articles and saw that it would be nice to combine them into one hash, but it didn't work.
This is a rudimentary question, but I would be grateful if you could answer it.

  • Answer # 1

    link_to ("Shop", "javascript: void (0)", {: class =>"dropdown-toggle",: aria_expanded =>"false",: data =>{: toggle =>"dropdown",: hover = >"dropdown",: delay =>"300",: close_others =>"true"}})

    For some reason, using the hash rocket as above worked.

  • Answer # 2

    With API dock, the implementation was as follows, but does this still give an error?
    (I feel like I don't have to use link_to in the first place ...)

    link_to ("Shop", "javascript: void (0)", class: "dropdown-toggle", data: {toggle: "dropdown", hover: "dropdown", delay: "300", close-others: "true" "}, aria-expanded:" false ")