Skip to content

Instantly share code, notes, and snippets.

@chensoren
Last active June 20, 2017 13:59
Show Gist options
  • Save chensoren/3174715 to your computer and use it in GitHub Desktop.
Save chensoren/3174715 to your computer and use it in GitHub Desktop.
generate an ordered array of hashes in form
<input type="text" name="linkeys[][eui]" class="sign_input">
<input type="text" name="linkeys[][code]" class="sign_input">
params[:linkeys][0] => {"code"=>"597516F5D90924764645C6D25023ECFC", "eui"=>"C8D2C10000000A03"}
# 更复杂的嵌套:
<%= text_field_tag "kpi[roas][][goal]", nil, placeholder: 'Goal', class: 'inline' %></div>
# 参考链接
1. https://stackoverflow.com/questions/16968509/rails-nested-attributes-array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment