I don't think link_to
is good inside option tag since as soon the user click the option to select it will be redirect to specified path which you may not want.
Try this:
options = [
[
"Weekly",
profile_path(@profile)
],
[
"Daily",
profile_path(@profile, :daily => "true")
]
]
<%= select_tag :filter, options_for_select(options, "Daily") %>
Sample Output:
<select id="filter">
<option value="/profile/1">Weekly</option>
<option value="/profile/2&daily=true">Daily</option>
</select>
If you want to add tooltip
in option you can either use title
or create it using css
or javascript
Example using title
options = [
[
"Weekly",
profile_path(@profile),
{ :title => profile_path(@profile) }
],
[
"Daily",
profile_path(@profile, :daily => "true"),
{ :title => profile_path(@profile, :daily => "true") }
]
]
<%= select_tag :filter, options_for_select(options, "Daily") %>
Sample Output:
<select id="filter">
<option title="/profile/1" value="/profile/1">Weekly</option>
<option title="/profile/2&daily=true" value="/profile/2&daily=true">Daily</option>
</select>