点击添加播放器后如何生成播放器位置? 我正在使用Ruby 1.9.3 rails 3.2.9和嵌套表单。 我的代码是:
<%= f.fields_for :event_players, :validate=>true do |player| %>
position : <%= player.text_field :position,:placeholder=>"Pos" %>
player name <%= player.text_field :name , :class => 'search_player_live_result-new',:placeholder=>"Player",:validate=>true%>
<%end%>
<%= f.link_to_add "add player", :event_players, :class=>"icon-plus no_of_places",:style=>"font-size: 14px;", :data => { :target => "#pokerResultPlayers" } %>
答案 0 :(得分:0)
您可以使用:
<%= f.fields_for :event_players, :validate=>true do |player| %>
serial number: <%= player.options[:child_index] %>
position : <%= player.text_field :position, :placeholder => "Pos" %>
player name <%= player.text_field :name, :class => 'search_player_live_result-new', :placeholder => "Player", :validate => true %>
<% end %>