ruby-on-railsslim-lang

Slim template include link tag in option tag


I am trying to have a dropdown (not part of a form) input where each option tag is a link to a controller action.

I've tried various ways of included it but nothing works

SELECT NAME="my-dropdown"
        OPTION VALUE="1111" steam turbine
        = link_to 'Action', path(my_action), class: 'nav-link'


Solution

  • As said by @Eyeslandic, you can do your stuff like this in slim :

    select name="my-dropdown" onchange="location = this.value;"
      option value="#{url_for 'Action', my_action_path}" class="nav-link"
        | steam turbine
    

    You can take a look at these websites to help you to write in slim :