1
我對形式的下拉我使用秒參數content_tag軌
<%= f.select(:visitable_id) do %>
<% @visitors.each do |visitor| %>
<%= content_tag(:option, visitor.name, value: visitor.id, data: {:type => visitor.class.name.to_s}) %>
<% end %>
<% end %>
提交時,我得到的控制器visitable_id。但我也想在content_tag中接收數據值的數據。 The:data:{:type => visitor.class.name.to_s}
如何訪問控制器中的第二個值?任何幫助,將不勝感激!
謝謝!正是我在找什麼! – Mitchell