문제

<% @divisions.each do |division| %>
  <td class="user_radio"><%= radio_button_tag("division_ids[]", division.id, false, :onClick=> 'redirect_to edit_division_path(division)')%></td>
  /* rest of the elements in the division */
  <% end %>

I need that on clicking the radio button the page gets redirected to the edit_division_path for the division being clicked.

But nothing happens. No error or anything else..

What am I doing wrong?

I am using rails 3..

도움이 되었습니까?

해결책

onClick is a javascript thing.

What you want is something like this:

:onClick => 'location.href="' + edit_division_path(division) + '"'

다른 팁

onclick = "document.location.href='somepage.htm'"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top