我有一个这样的 Rails 更新表格:
<%= debug @ballot.scores %>
<%= simple_form_for(@ballot, :url => "/vote/#{@election.id}/ballot/#{@ballot.position}/submit", :method => :post, :html => {:class => 'form-horizontal' }) do |f| %>
<% f.fields_for :scores do |builder| %>
<div class="slider">Slider goes here!</div>
<%= builder.hidden_field :initialValue, :value => 50 %>
<% end %>
<%= f.button :submit %>
<% end %>
调试显示:
---
- !ruby/object:Score
attributes:
id: 1
ballot_id: 4
candidate_id: 4
initialScore:
normalizedScore:
created_at: 2013-08-08 05:00:10.391163000 Z
updated_at: 2013-08-08 05:00:10.432374000 Z
- !ruby/object:Score
attributes:
id: 2
ballot_id: 4
candidate_id: 5
initialScore:
normalizedScore:
created_at: 2013-08-08 05:00:10.418904000 Z
updated_at: 2013-08-08 05:00:10.434772000 Z
所以肯定有得分对象,但是没有“滑块在这里!” 文本显示在页面上。为什么这不起作用?
如果您需要更多信息,请告诉我:)